Forum: Ruby on Rails Retrieve the current controller name from a view

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.
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-05-15 15:31
(Received via mailing list)
Hi all, I wonder if it's possible to retrieve the current controller
name and possibly the action when you're in a view.

i.e. I call the same template/partial view from different controllers
and I'd like to know when I'm in the view code which controller is
calling it...

Any ideas? Sorry if it's obvious but I couldn't find it in the doc.

Gael
30ee518e6fdc5b07e060775b5a542bdb?d=identicon&s=25 Jón Borgþórsson (jongretar)
on 2006-05-15 15:40
(Received via mailing list)
<%= controller.controller_name -%>
<%= controller.action_name -%>

On 5/15/06, Gael Pourriel <gael.pourriel@gmail.com> wrote:
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-05-15 15:47
(Received via mailing list)
Thanks, I knew it would be that simple....
This topic is locked and can not be replied to.