Hmmm… maybe a better way of doing it is this…
In your layout, you can retrieve the current controller action using:
<%= controller.action_name %>
And you can retrieve the current controller’s name using:
<%= controller.controller_name %>
IMHO this might be better than checking the page title, since this will
enable you to decouple your menu logic from the page title.
Hope this helps!
Sebastian Conrad wrote:
My issue was that I wanted to have a layout file for all different
controllers, but have a dynamic menu so that I could have a different
menu icon in the menu depending on which page was displayed. For that, I
wanted to check which the current page was by using the current_page?()
However, I managed to work around this by using a page title variable I
set for all different controllers, and it worked flawlessly. Now I just
check and see if the page title matches the link title in the menu, and
that seems to work.