...

/

Instance Methods Should Implement Domain Concepts from the DB

Instance Methods Should Implement Domain Concepts from the DB

Learn how instance methods should implement concepts from the database of our Rails application.

Modeling derived data in Active Record methods

Outside of business logic, the most common area of trouble has to do with derived data—data whose value is based on the data in the database. We see this when we’re dealing with methods on an Active Record. Sometimes, this derived data is presentational and use case specific, but other times, it represents a true domain concept that is core to the models’ existence. We need to be careful about how we model the data inside the application. This requires a solid understanding of our domain and ...