Browse files

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.
  • Loading branch information...
wangjohn committed Sep 24, 2013
1 parent b1178ae commit 3ecf26f48ae10b9d11b2db867fa57cf25ee99bed
Showing with 1 addition and 0 deletions.
  1. +1 −0 activerecord/lib/active_record/attribute_assignment.rb
@@ -15,6 +15,7 @@ def assign_attributes(new_attributes)
if !new_attributes.respond_to?(:stringify_keys)
raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."
+ return if new_attributes.blank?
attributes = new_attributes.stringify_keys
multi_parameter_attributes = []

0 comments on commit 3ecf26f

Please sign in to comment.