Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Security Article Part 2 - 6

View user_creation.rb
1 2 3 4 5 6 7 8
User.create!
# -> #<User id: 2, can_do_dangerous_things: false, ...>
 
User.create!(:can_do_dangerous_things => true)
# -> ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: can_do_dangerous_things
 
User.create!(:permissions => {:can_do_dangerous_things => true})
# -> #<User id: 2, can_do_dangerous_things: true, ...>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.