Rails – How to refresh an association after a save

For single-item associations:

book.reload_author

For other associations:

author.books.reload

http://guides.rubyonrails.org/association_basics.html#controlling-caching


In older versions of rails, before Rails 5, you could pass true to an association method as the first parameter to make it reload: author.books(true).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)