Forum: Ruby on Rails How to read back what controller I am in?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sean Lerner (Guest)
on 2007-03-28 23:32
(Received via mailing list)
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
Jason R. (Guest)
on 2007-03-28 23:38
(Received via mailing list)
params[:controller] I believe.

Jason
mudge (Guest)
on 2007-03-28 23:38
(Received via mailing list)
<%= controller.controller_name %>

Will print the name of the current controller.

Hope this helps,

-- Paul
Sean Lerner (Guest)
on 2007-03-28 23:55
(Received via mailing list)
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.
This topic is locked and can not be replied to.