aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-10 10:30:27 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-10 10:30:27 +0200
commit9e4b715d790aa84dfb3d7aa332e0012cbc264394 (patch)
treecb6852861de2744552a3ea2a09c7e83344b37ca0 /activerecord/lib/active_record
parent86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9 (diff)
downloadrails-9e4b715d790aa84dfb3d7aa332e0012cbc264394.tar.gz
rails-9e4b715d790aa84dfb3d7aa332e0012cbc264394.tar.bz2
rails-9e4b715d790aa84dfb3d7aa332e0012cbc264394.zip
Ensure assign_attributes and update_attributes do not fail on nil, closes #478.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 67af21c9a0..d07f9365b3 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1688,6 +1688,8 @@ MSG
# user.name # => "Josh"
# user.is_admin? # => true
def assign_attributes(new_attributes, options = {})
+ return unless new_attributes
+
attributes = new_attributes.stringify_keys
role = options[:as] || :default