method
validate
rails latest stable - Class:
ActiveRecord::Validations
validate(context = nil)public
Alias for ActiveRecord::Validations#valid?
1Note
Validate() is run always before one of the more specific validation methods
I did not see this mentioned explicitly anywhere.
The method +validate+ is run always before a call to +validate_on_create+ or +validate_on_update+ is made.
Example:
class Foo < ActiveRecord::Base
def validate
puts 'In validate'
end
def validate_on_create
puts 'In validate_on_create'
end
def validate_on_update
puts 'In validate_on_update'
end
end
Now, when creating a new Foo using script/console, the output is as follows:
In validate
In validate_on_create
and when updating a Foo, the output looks like:
In validate
In validate_on_update