Skip to content

Instantly share code, notes, and snippets.

@chrisyeung1121
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 => 'chris@mac.com', :password=> nil
puts sign_up_params
# $> {"email"=>"123@asdf.com", "password"=>""}
puts sign_up_params.select{|k,v| v.present?}
# $> {"email"=>"123@asdf.com"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment