diff options
author | wangjohn <wangjohn@mit.edu> | 2013-09-24 13:04:32 -0500 |
---|---|---|
committer | wangjohn <wangjohn@mit.edu> | 2013-09-24 13:22:59 -0500 |
commit | 3ecf26f48ae10b9d11b2db867fa57cf25ee99bed (patch) | |
tree | 531a58ecfda6342ffb0b2c645549989c1e251f3c /activerecord | |
parent | b1178aef3b44bd9e0153d2c4f8a2a2a590949999 (diff) | |
download | rails-3ecf26f48ae10b9d11b2db867fa57cf25ee99bed.tar.gz rails-3ecf26f48ae10b9d11b2db867fa57cf25ee99bed.tar.bz2 rails-3ecf26f48ae10b9d11b2db867fa57cf25ee99bed.zip |
assign_attributes should return if argument is blank.
If you are passed an empty hash, then assign_attributes doesn't need to
do any work and can just return early. This should fix the failing Agile
Web Development tests.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_assignment.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index f201f86e22..30fa2c8ba5 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -15,6 +15,7 @@ module ActiveRecord if !new_attributes.respond_to?(:stringify_keys) raise ArgumentError, "When assigning attributes, you must pass a hash as an argument." end + return if new_attributes.blank? attributes = new_attributes.stringify_keys multi_parameter_attributes = [] |