diff options
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ae15bc0c31..829d4f0a5d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1348,18 +1348,20 @@ module ActiveRecord #:nodoc: # from this form of mass-assignment by using the +attr_protected+ macro. Or you can alternatively # specify which attributes *can* be accessed in with the +attr_accessible+ macro. Then all the # attributes not included in that won't be allowed to be mass-assigned. - def attributes=(attrs) - return if attrs.nil? - attributes= attrs.dup + def attributes=(new_attributes) + return if new_attributes.nil? + attributes = new_attributes.dup attributes.stringify_keys! multi_parameter_attributes = [] remove_attributes_protected_from_mass_assignment(attributes).each do |k, v| k.include?("(") ? multi_parameter_attributes << [ k, v ] : send(k + "=", v) end + assign_multiparameter_attributes(multi_parameter_attributes) end + # Returns a hash of all the attributes with their names as keys and clones of their objects as values. def attributes clone_attributes :read_attribute |