From 3d0a9ff437c5e06f8baa6e9a40049411dda8bd0e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Feb 2006 00:41:01 +0000 Subject: Aesthetics, baby git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3658 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3