diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-05-10 13:44:43 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-05-10 13:44:43 +0000 |
commit | ffb9db0247084514adc73ae92dfe8d5a3033226b (patch) | |
tree | 0fe2fe4f71717c7b35d84708a46bfb26a8a9bd96 /activerecord | |
parent | c247370cae6ce681648b8272bf18562addea2353 (diff) | |
download | rails-ffb9db0247084514adc73ae92dfe8d5a3033226b.tar.gz rails-ffb9db0247084514adc73ae92dfe8d5a3033226b.tar.bz2 rails-ffb9db0247084514adc73ae92dfe8d5a3033226b.zip |
copy edits [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_assignment.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index 5007e319da..87ecbe54f1 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -12,15 +12,14 @@ module ActiveRecord # of this method is +false+ an <tt>ActiveModel::ForbiddenAttributesError</tt> # exception is raised. # - # Example: - # # cat = Cat.new(name: "Gorby", status: "yawning") - # cat.attributes # => {"name" => "Gorby", "status" => "yawning"} + # cat.attributes # => { "name" => "Gorby", "status" => "yawning" } # cat.assign_attributes(status: "sleeping") - # cat.attributes # => {"name" => "Gorby", "status" => "sleeping"} + # cat.attributes # => { "name" => "Gorby", "status" => "sleeping" } + # + # New attributes will be persisted in the database when the object is saved. # - # New attributes will be persisted to database when object is saved. - # <tt>attributes =</tt> is an alias. + # Aliased to <tt>attributes=</tt>. 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." |