Validations Don’t Provide Data Integrity
Learn about data integrity via validations in our Rails application.
Now that we’ve had an intro to models, a full discussion of business logic, and a journey through database design, we want to cap off the models discussion by talking about validations, callbacks, scopes, and testing. Then, we can see an end-to-end example of how this all fits together, which will paint a complete picture of the sustainable approach to business logic.
We’ve made the point several times to keep business logic out of Active Records, but we’ve also heavily implied that we should be using validations, which are a form of business logic. We also talked briefly about managing queries, along with a handful of references to avoid callbacks. This chapter will cover all of these ...