assign_attributes
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (-30)
- 4.1.8 (0)
- 4.2.1 (21)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
assign_attributes(new_attributes)
public
Allows you to set all the attributes by passing in a hash of attributes with keys matching the attribute names (which again matches the column names).
If the passed hash responds to permitted? method and the return value of this method is false an ActiveModel::ForbiddenAttributesError exception is raised.
ActiveModel::MassAssignmentSecurity::Error
Note that in the example shown in the documentation, `user.assign_attributes({ :name => ‘Josh’, :is_admin => true })` would raise a `ActiveModel::MassAssignmentSecurity::Error` and would not actually update user.name, contrary to what the example seems to demonstrate.