diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-10 19:54:27 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-10 19:54:27 -0300 |
commit | 247ac954132222fdd399cddc264bc1d4029f750c (patch) | |
tree | 680a07197aa207279a3455327c62843b256fe88a /activerecord/lib/active_record/base.rb | |
parent | d7b98b3ca855418f88a9e979d32c1710040b3038 (diff) | |
parent | 47ff57f6d14fe161900bf85e2d2cf6d7e21a1eb8 (diff) | |
download | rails-247ac954132222fdd399cddc264bc1d4029f750c.tar.gz rails-247ac954132222fdd399cddc264bc1d4029f750c.tar.bz2 rails-247ac954132222fdd399cddc264bc1d4029f750c.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 48db9fb942..4f0c11d883 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -3141,11 +3141,11 @@ module ActiveRecord #:nodoc: def execute_callstack_for_multiparameter_attributes(callstack) errors = [] callstack.each do |name, values| - klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass - if values.empty? - send(name + "=", nil) - else - begin + begin + klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass + if values.empty? + send(name + "=", nil) + else value = if Time == klass instantiate_time_object(name, values) elsif Date == klass @@ -3159,9 +3159,9 @@ module ActiveRecord #:nodoc: end send(name + "=", value) - rescue => ex - errors << AttributeAssignmentError.new("error on assignment #{values.inspect} to #{name}", ex, name) end + rescue => ex + errors << AttributeAssignmentError.new("error on assignment #{values.inspect} to #{name}", ex, name) end end unless errors.empty? @@ -3187,7 +3187,7 @@ module ActiveRecord #:nodoc: end def type_cast_attribute_value(multiparameter_name, value) - multiparameter_name =~ /\([0-9]*([a-z])\)/ ? value.send("to_" + $1) : value + multiparameter_name =~ /\([0-9]*([if])\)/ ? value.send("to_" + $1) : value end def find_parameter_position(multiparameter_name) |