Skip to content

Commit

Permalink
update return values to reflect the proper object class
Browse files Browse the repository at this point in the history
  • Loading branch information
cjilbert504 committed Dec 13, 2022
1 parent ba76451 commit 696ed4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions guides/source/association_basics.md
Expand Up @@ -1006,10 +1006,10 @@ Does the same as `create_association` above, but raises `ActiveRecord::RecordInv
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.

```ruby
@book.author # => #<Book author_number: 123, author_name: "John Doe">
@book.author # => #<Author author_number: 123, author_name: "John Doe">
@book.author_changed? # => false

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

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

```ruby
@book.author # => #<Book author_number: 123, author_name: "John Doe">
@book.author # => #<Author author_number: 123, author_name: "John Doe">
@book.author_previously_changed? # => false

@book.author = Author.second # => #<Book author_number: 456, author_name: "Jane Smith">
@book.author = Author.second # => #<Author author_number: 456, author_name: "Jane Smith">
@book.save!
@book.author_previously_changed? # => true
```
Expand Down

0 comments on commit 696ed4e

Please sign in to comment.