开发者

after_create and after_save order

开发者 https://www.devze.com 2023-03-05 06:08 出处:网络
I have done some tests, and I have find out that after_create is called before than after_save (in Rails 2.3.开发者_JS百科9)

I have done some tests, and I have find out that after_create is called before than after_save (in Rails 2.3.开发者_JS百科9)

Is that correct ?

thanks


Yes, here's 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消