Using Basic and Custom Rails Validations

Rails Validations

In Rails, validations are special method calls defined at the top of the model class. Validations protect your database by preventing model instances from being saved to the database if they contain invalid data. Rails uses ActiveRecord to execute these validations. Keep in mind that AR validations are not the same as database validations, which check for things such as string length, data type, etc.

In the following post I’m going to cover implementing both basic and custom Rails validations. I had a tough time figuring out how to make the custom validations work since there was a lack of detailed information about them.

Continue reading “Using Basic and Custom Rails Validations”