Ruby Validation Methods
Greetings Mate, In this article, you will learn how to validate data in Ruby on Rails. Validations allow us to make sure that data meets a set of requirements before it's saved to the database. You can think of them as rules that our data must follow. We could validate data every time a form is submitted, in other words, put our validation code in our controllers, but that would make it so that the rules are only enforced when we go through one of those controller actions. And then we'd be repeating ourselves every time we had to go through a controller that made updates to the same database tables. It's much better to enforce the rules all the time globally in our application. And since this concerns the application's interaction with the database, the model is the best place for it. That way the rules will be enforced right at t...