From 3ecf26f48ae10b9d11b2db867fa57cf25ee99bed Mon Sep 17 00:00:00 2001 From: wangjohn Date: Tue, 24 Sep 2013 13:04:32 -0500 Subject: [PATCH] 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. --- activerecord/lib/active_record/attribute_assignment.rb | 1 + 1 file changed, 1 insertion(+) 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 = []