method
validate
v7.0.0 -
Show latest stable
-
1 note -
Class: ActiveRecord::Validations
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (3)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1 (-25)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
validate(context = nil)
public
Alias for ActiveRecord::Validations#valid?
Register or
log in
to add new notes.
jlamberg -
June 25, 2009
1 thank
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