I know I've seen this somewhere before, but my friend Google and I just
can't seem to recall where.

I would like to change the style of a link (in my application layout) based
upon which controller is currently active.

This is what I have, which doesn't work:

<%= link_to "Part", part_path, :class => @controller.name == "parts" ?
'selectedmenu' : 'unselectedmenu' %>

I'm sure I've seen this sort of construct in the past, but I can't recall
how to construct it.  Specifically, this bombs because name is undefined.  I
can probably figure that one out myself.  More generally, is there a nice
helper method defined to select a specific class based on the controller?

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to