开发者

rails observer custom callback

开发者 https://www.devze.com 2023-02-11 02:47 出处:网络
How to implement custom call_back and then register method into observer? If we use transaction into the model, is after_create is triggered for every single record inside the transaction or is trigg
  1. How to implement custom call_back and then register method into observer?

  2. If we use transaction into the model, is after_create is triggered for every single record inside the transaction or is triggered after transaction is finished?

Using Rails 3

Than开发者_如何学编程ks


  1. You add the method, say, :after_something to your observer, and then issue notify_observers(:after_something) in your code in model. The method will receive the model instance as a parameter.

  2. after_create is called for the observer of the class which instance was created. Each instance.

0

精彩评论

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