开发者

rails observer custom callback

  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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜