Forum: Ruby on Rails Current controller

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.
7864d809993744583d15b0f0a2f8dded?d=identicon&s=25 Marius Žilėnas (kronidas)
on 2006-03-25 10:44
Hello railists,

I have a list of news headers on my index page. I would like to hide
this list if current controller is 'news'.
I put to main/index.rhtml
"<% unless @controller == "news" %> list here news headers <% end %>

. This doesn't work.

So, the question is how to get current controller name in template ?

Thank You!
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-25 11:07
(Received via mailing list)
7864d809993744583d15b0f0a2f8dded?d=identicon&s=25 Marius Žilėnas (kronidas)
on 2006-03-25 11:49
Emin Hasanov wrote:
> controller.controller_name
> http://api.rubyonrails.com/classes/ActionControlle...

thank you, it works!
This topic is locked and can not be replied to.