How to get the record object (which is just updated or created) in after_save method in an observer in rails 3?
I am using a observer to separate the unrelated logic from the model.
The scenario is, suppose a record is created or updated in a model, then how can we get that record object in t开发者_Python百科he model's observer's after_save method?
Try like this in your observer...
def after_save(model) --- # model will the current model object --- end
This observer method is going to be deprecated..
use this
Model << ActiveXXXXX
after_save :after_save_callback
def after_save_callback
#things to be done
end
精彩评论