You can use caller inside the method, or perhaps params[:action].
I wouldn''t do it that way though. Just allow the method to take a
parameter
specifiying if that extra bit of code should be run.
-Jonathan.
On 9/2/06, Marston <sugarstats-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> Hey guys, quick question,
>
> What''s the easiest way in rail to check which action called
another
> method?
>
> For example, say I wanted to run a method inside a method but only if
> called by a specific top method.
>
> i.e
>
> def method_1
> # Only run if called by a specific method
> if <insert check calling method code here> == "specific
method"
> method_2()
> end
> end
>
> Thanks
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---