1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
wangjohn 2013-09-24 13:04:32 -05:00
parent b1178aef3b
commit 3ecf26f48a

View file

@ -15,6 +15,7 @@ module ActiveRecord
if !new_attributes.respond_to?(:stringify_keys) if !new_attributes.respond_to?(:stringify_keys)
raise ArgumentError, "When assigning attributes, you must pass a hash as an argument." raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."
end end
return if new_attributes.blank?
attributes = new_attributes.stringify_keys attributes = new_attributes.stringify_keys
multi_parameter_attributes = [] multi_parameter_attributes = []