method
validate
v1.1.6 -
Show latest stable
- Class:
ActiveRecord::Validations::ClassMethods
validate(*methods, &block)public
No documentation available.
# File activerecord/lib/active_record/validations.rb, line 239
def validate(*methods, &block)
methods << block if block_given?
write_inheritable_set(:validate, methods)
end 2Notes
You can call several times
You can call it several times, like:
class Comment < ActiveRecord::Base
validate :must_be_friends
validate :must_be_awesome
...
or with several arguments:
class Comment < ActiveRecord::Base
validate :must_be_friends, :must_be_awesome
...
You can call it with an { :on => ~~~ } as the last argument
For example: validate :must_be_friends, :on => :create