How are observers and callbacks different from each other?
Answer / Ashok Kumar Yadav
In Ruby on Rails, Observers are classes that observe Active Record models and respond to specific events (e.g., before_save or after_create). Callbacks, on the other hand, are methods defined within a model that are called automatically during certain events in the life cycle of the object (e.g., `before_save` callback method within a model). Observers can be used to perform tasks across multiple models, while callbacks are specific to one model.
| Is This Answer Correct ? | 0 Yes | 0 No |
what is Rails Migration?
how you can run Rails application without creating databases?
Who designed active record in rails?
How is the model view controller framework used in ruby on rails?
Are there any disadvantages of ruby on rails? If yes, mention them.
Explain the advantages of ruby on rails?
What is the main difference between procs and blocks?
Tell me what is orm (object-relationship-model) in rails?
Do you know what is “yield” in ruby on rails?
what are the limits of Ruby on Rails?
Please explain what are the positive aspects of rails?
What is the difference between false and nil in ruby?