Hey All, Is there a global var or something that holds the name of the controller that called a given helper? I''m trying to re-use a partial, which calls a helper, and need to do something slightly different depending on which controller called the helper. Thanks! -Roy Roy Pardee Research Analyst/Programmer Group Health Center For Health Studies (Cancer Research Network) (206) 287-2078 Google Talk: rpardee --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
controller and action are always in your params If you can do params[:id] then you can do params[:controller] :) On Thu, Jul 17, 2008 at 1:05 PM, Pardee, Roy <pardee.r-go57ItdSaco@public.gmane.org> wrote:> > Hey All, > > Is there a global var or something that holds the name of the controller > that called a given helper? I''m trying to re-use a partial, which calls > a helper, and need to do something slightly different depending on which > controller called the helper. > > Thanks! > > -Roy > > Roy Pardee > Research Analyst/Programmer > Group Health Center For Health Studies (Cancer Research Network) > (206) 287-2078 > Google Talk: rpardee > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Ah--and the params hash is accessible from my helper--bitchin''! I''m set... Thanks very much!. ________________________________ From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Brian Hogan Sent: Thursday, July 17, 2008 11:10 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Re: which controller called my helper method? controller and action are always in your params If you can do params[:id] then you can do params[:controller] :) On Thu, Jul 17, 2008 at 1:05 PM, Pardee, Roy <pardee.r-go57ItdSaco@public.gmane.org> wrote: Hey All, Is there a global var or something that holds the name of the controller that called a given helper? I''m trying to re-use a partial, which calls a helper, and need to do something slightly different depending on which controller called the helper. Thanks! -Roy Roy Pardee Research Analyst/Programmer Group Health Center For Health Studies (Cancer Research Network) (206) 287-2078 Google Talk: rpardee --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---