How to read back what controller I am in?


#1

Hello,

Is there a way I can determine in my .rhtml as to what controller is
currently being executed? (perhaps an environment variable?)

For example, if my controller is named “display”, and I put:

<%= WHATEVER_SHOULD_BE_HERE %>

then it would output:

display

thanks,

Sean


#2

params[:controller] I believe.

Jason


#3

<%= controller.controller_name %>

Will print the name of the current controller.

Hope this helps,

– Paul


#4

Thanks… I realized it a few minutes after I posted – it’s been
staring me in the face all this time (that is params[:controller] =>
display in development mode). My head’s cloudy this afternoon, and I
should know better than to post to the list for help with a cloudy
head.