Skip to content

Commit caaac48

Browse files
Merge pull request rails#46709 from cjilbert504/belongs-to-association-changed-guide-update
update return values to reflect the proper object class [ci-skip]
2 parents ac3ab2d + 696ed4e commit caaac48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

guides/source/association_basics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,10 @@ Does the same as `create_association` above, but raises `ActiveRecord::RecordInv
10061006
The `association_changed?` method returns true if a new associated object has been assigned and the foreign key will be updated in the next save.
10071007

10081008
```ruby
1009-
@book.author # => #<Book author_number: 123, author_name: "John Doe">
1009+
@book.author # => #<Author author_number: 123, author_name: "John Doe">
10101010
@book.author_changed? # => false
10111011

1012-
@book.author = Author.second # => #<Book author_number: 456, author_name: "Jane Smith">
1012+
@book.author = Author.second # => #<Author author_number: 456, author_name: "Jane Smith">
10131013
@book.author_changed? # => true
10141014

10151015
@book.save!
@@ -1021,10 +1021,10 @@ The `association_changed?` method returns true if a new associated object has be
10211021
The `association_previously_changed?` method returns true if the previous save updated the association to reference a new associate object.
10221022

10231023
```ruby
1024-
@book.author # => #<Book author_number: 123, author_name: "John Doe">
1024+
@book.author # => #<Author author_number: 123, author_name: "John Doe">
10251025
@book.author_previously_changed? # => false
10261026

1027-
@book.author = Author.second # => #<Book author_number: 456, author_name: "Jane Smith">
1027+
@book.author = Author.second # => #<Author author_number: 456, author_name: "Jane Smith">
10281028
@book.save!
10291029
@book.author_previously_changed? # => true
10301030
```

0 commit comments

Comments
 (0)