Rails ActiveRecord Validation Reference



I’ve found myself relying more and more on Rails validators.  I used to code funky validation logic in ColdFusion and even PHP to, for example, check to see whether or not a username already existed in the database.  While this can be done at the database level or in the application (where I used to do it) I prefer the Rails approach of handling it in the model.

The most beautiful thing is that validation methods are generally simple one-liners that let me focus on the presentation of the error message and not the logic behind it.  At any rate, the point of this post is share a link I’ve found very useful over the past few weeks.  Here’s a link to the ActiveRecord validation methods:

http://ar.rubyonrails.com/classes/ActiveRecord/Validations/ClassMethods.html 



Leave a Reply