method
attributes=
v3.2.13 -
Show latest stable
- Class:
ActiveRecord::AttributeAssignment
attributes=(new_attributes)public
Allows you to set all the attributes at once by passing in a hash with keys matching the attribute names (which again matches the column names).
If any attributes are protected by either attr_protected or attr_accessible then only settable attributes will be assigned.
class User < ActiveRecord::Base attr_protected :is_admin end user = User.new user.attributes = { :username => 'Phusion', :is_admin => true } user.username # => "Phusion" user.is_admin? # => false