Create a gist now

Instantly share code, notes, and snippets.

Security Article Part 2 - 6
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