After_create and after_save

I did some tests and I found out that after_create is called before after_save (in Rails 2.3.9)

Is it correct?

thanks

+7
source share
2 answers

Yes, here is the order:

# (1) before_validation # (2) before_validation_on_create # (3) after_validation # (4) after_validation_on_create # (5) before_save # (6) before_create # (7) after_create # (8) after_save 

Found here:

http://ar.rubyonrails.org/classes/ActiveRecord/Callbacks.html

+21
source

And remember that callback after_create only takes time. This is the difference between after_save and after_create

0
source

All Articles