Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

NestedAttributes: call reload after saving to see deletions reflected in

nested associations. Docs now match actual behavior.
  • Loading branch information...
commit c61bb08d0e95530086570bd1e2e874e36d6fb711 1 parent 38e6eb7
@robolson robolson authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/nested_attributes.rb
View
4 activerecord/lib/active_record/nested_attributes.rb
@@ -72,7 +72,7 @@ module NestedAttributes #:nodoc:
# member.avatar_attributes = { :id => '2', :_delete => '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.
#
@@ -160,7 +160,7 @@ module NestedAttributes #:nodoc:
# 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
#
Please sign in to comment.
Something went wrong with that request. Please try again.