Forum: Ruby on Rails ActiveModel callbacks

Posted by Robert K. (prenethus)
on 2010-02-08 22:12
Hi,

I've set up several ActiveModel callbacks an run them via

_run_whatever_callbacks do
 .. some code
end

Now i would like to run the before_whatever and after_whatever
independently, aka
_run_before_whatever_callbacks. Is that somehow possible?

I need that for running the callbacks on a set ob sub-objects, and i
dont know how to nest the blocks dynamically (without any crazy hacks
:-).


in short, I'd like to do something like that:

subobjects.each { |obj| obj._run_before_whatever_callbacks }
... some code
subobjects.each { |obj| obj._run_after_whatever_callbacks }


Thanks,
Robert
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.