Posted about 3 years ago. Visible to the public. Repeats. Linked content.

How to reload a belongs_to association

To reload a single-item association in Rails 5+, call #reload_<association>:

Copy
post.reload_author

In older Railses you can say

Copy
post.author(true)

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Avatar
Dominik Schöler
Last edit:
12 days ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more