I was wandering why in books like Agile Web Development with Rails there’s no mention to validates_whatever_of way of validating, all validation examples are done using validates :attr, :whatever => true ? I’ve just started learning Rails and this made me confused!
I was wandering why in books like Agile Web Development with Rails there’s no
Share
In Rails 2.x, where you would have said something like:
in 3.x, you now do:
The old way is still supported, I think, but it is deprecated.
It’s really just a different way of expressing the same thing. While older books and tutorials will use the former, it should be fairly simple to translate that to 3.x style. See http://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html#method-i-validates for example.