Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Rails ActiveRecord Validation Reference

Aug 06

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