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
I don’t want to place the do_this code inside do_that, or call do_this
inside do_that
def do_that
…
do_this if rtn == true
end
Thanks in advice
On Mar 22, 7:28 pm, Sergio S. [email protected] wrote:
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