ActiveRecord callbacks execute sequence
before_validation 
before_validation_on_create 
after_validation 
after_validation_on_create 
before_save 
before_create 
insert operation
after_create 
after_save 
ActiveRecord callback instance methods execute ways on create will revok before_validation_on_create callback before ActiveRecord validation methods, and before_create callback will revoke after ActiveRecord validation methods and helpers, like validates_associated, validates_each.
If a new record has some error, and will not be validated by ActiveRecord validation methods and helpers, then after_validation and before_create callback will not be revoked.
No comments :
Post a Comment