diff options
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index f79a12a95c..d8fae495e7 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -49,14 +49,14 @@ module ActiveRecord # create the member and avatar in one go: # # params = { :member => { :name => 'Jack', :avatar_attributes => { :icon => 'smiling' } } } - # member = Member.create(params) + # member = Member.create(params[:member]) # member.avatar.id # => 2 # member.avatar.icon # => 'smiling' # # It also allows you to update the avatar through the member: # - # params = { :member' => { :avatar_attributes => { :id => '2', :icon => 'sad' } } } - # member.update_attributes params['member'] + # params = { :member => { :avatar_attributes => { :id => '2', :icon => 'sad' } } } + # member.update_attributes params[:member] # member.avatar.icon # => 'sad' # # By default you will only be able to set and update attributes on the @@ -75,7 +75,7 @@ module ActiveRecord # member.avatar_attributes = { :id => '2', :_destroy => '1' } # member.avatar.marked_for_destruction? # => true # member.save - # member.avatar #=> nil + # member.reload.avatar #=> nil # # Note that the model will _not_ be destroyed until the parent is saved. # @@ -179,7 +179,7 @@ module ActiveRecord # member.posts.detect { |p| p.id == 2 }.marked_for_destruction? # => true # member.posts.length #=> 2 # member.save - # member.posts.length # => 1 + # member.reload.posts.length # => 1 # # === Saving # |