Wednesday, October 6, 2010

[Rails] Rails 3 - Referencing the URL to determine if a Nav Item is class=“selected”

The app can have the following URLs:

<li> /projects/ </li>
<li> /projects/3 </li>
<li> /projects/3/photos </li>
<li> /projects/3/photos/312 </li>

I'd like to know how in Rails 3 I can look at the current URL and know
which of the lines above is currently active, so I can add a
class="selected"

Additional exmaple..

If the user's browser is on: /projects

And the Nav looks like

Projects
- Photos
- Files

Projects is Active

but if the user's browser is on: /files

Projects is active

and Files is active (they both apply).


Ideas? thanks

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate