Active Record Callbacks

Callbacks allow logic to be triggered before or after an alteration of the object’ Active Record state. Remember there are 7 Active Record states.

Callbacks can be used to make sure that associated and dependent objects are deleted when destroy is called (by overwriting before_destroy).

There are 19 Callbacks
1. :after_initialize
2. :after_find
3. :after_touch
4. :before_validation
5. :after_validation
6. :before_save
7. :around_save
8. :after_save
9. :before_create
10. :around_create
11. :after_create
12. :before_update
13. :around_update
14. :after_update
15. :before_destroy
16. :around_destroy
17. :after_destroy
18. :after_commit
19. :after_rollback

what are your thoughts?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s