On Mar 22, 7:28 pm, Sergio Sergio
<sergio.spr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---