Contenu connexe Similaire à ActiveRecord Observers - RORLab Season 3-6 Similaire à ActiveRecord Observers - RORLab Season 3-6 (20) ActiveRecord Observers - RORLab Season 3-62. Contents
• The Object Life Cycle
• Validations Overview
• Validation Helpers
• CommonValidation
Options
• ConditionalValidation
• CustomValidations
• Working withValidation
Errors
• DisplayingValidation Errors
in theView
• Callbacks Overview
• Available Callbacks
• Running Callbacks
• Skipping Callbacks
• Halting Execution
• Relational Callbacks
• Conditional Callbacks
• Callback Classes
• Observers
• Transaction Callbacks
Validations Callbacks
3. Callback Classes
• To reuse callback methods for other models
as an instance method
a model object
instance
method
5. Observers
• Similar to callbacks
• for the callbacks with the code that isn’t
directly related the model
• without changing the code of the model
• ex. sending confirmation email after user
registration