Field note
What it does
Active Record Callbacks This guide teaches you how to hook into the life cycle of your Active Record objects. After reading this guide, you will know: When certain events occur during the life of an Active Record object. How to register, run, and skip callbacks that respond to these events. How to create relational, association, conditional, and transactional callbacks. How to create objects that encapsulate common behavior for your callbacks to be reused. Skip to article body Chapters The Object Life Cycle Callback Registration Registering Callbacks to Fire on Life Cycle Events Available Callbacks Creating an Object Updating an Object Destroying an Object after_initialize and after_find after_touch Running Callbacks Conditional Callbacks Using :if and :unless with a Symbol Using :if and :unless with a Proc Multiple Callback Conditions Using Both :if and :unless Skipping Callbacks Suppressing Saving Halting Execution Association Callbacks Cascading Association Callbacks Transaction Callbacks after_commit and after_rollback Aliases for after_commit Transactional Callback Ordering Per transaction callback ActiveRecord.after_all_transactions_commit Callback Objects 1. The Object Life Cycle During the normal operation of a Rails application, objects may be created, updated, and destroyed . Active Record provides hooks into this object life cycle so that you can control your application and its data.
Capabilities
Available capabilities
Tags
Tags
No tags filed yet.
Ways to use it
Ways to use it
No integrations filed yet.