before_filter on Models

Hello everyone, is there a way to do something like after_filter on models ? I would like to do something after one method in the model is executed, I don’t want to place that code in the model’s method, I would like to keep them in different methods, is there a way to do this ?

something like this:

after_filter :do_this, :only => do_that

def do_that … end

Hello everyone, is there a way to do something like after_filter on models ? I would like to do something after one method in the model is executed, I don't want to place that code in the model's method, I would like to keep them in different methods, is there a way to do this ?

You might be interested in callbacks or observers. It wouldn't be massively hard to write a small piece of magic so that

after_filter :do_this, :only => do_that

replaced the do_that method with one that called do_that and do_this if you really wanted to.

Fred