Which controller called my helper method?

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 P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee

controller and action are always in your params

If you can do params[:id] then you can do params[:controller] :slight_smile:

Ah–and the params hash is accessible from my helper–bitchin’!

I’m set…

Thanks very much!.


From: [email protected]
[mailto:[email protected]] On Behalf Of Brian H.
Sent: Thursday, July 17, 2008 11:10 AM
To: [email protected]
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] :slight_smile:

On Thu, Jul 17, 2008 at 1:05 PM, Pardee, Roy [email protected] 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 P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs