Skip to content

Instantly share code, notes, and snippets.

@chrisyeung1121
Last active August 29, 2015 14:19
Show Gist options
  • Save chrisyeung1121/4853b1c0dc0e64147970 to your computer and use it in GitHub Desktop.
Save chrisyeung1121/4853b1c0dc0e64147970 to your computer and use it in GitHub Desktop.
8_ruby_select
def sign_up_params
params.require(:user).permit(:email,:password)
end
# If user input :email => '[email protected]', :password=> nil
puts sign_up_params
# $> {"email"=>"[email protected]", "password"=>""}
puts sign_up_params.select{|k,v| v.present?}
# $> {"email"=>"[email protected]"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment