This project is archived and is in readonly mode.

#395 ✓invalid
Ary Djmal


Reported by Ary Djmal | June 11th, 2008 @ 11:45 PM

This patch adds a url helper that allows you to create a link, adding the class "current" when in the current page.

I've found myself using this helper much more than link_to_unless_current. And because almost every site has some sort of tabbed navigation, I think it makes sense to push it to rails.

== Examples

Let's say you have a navigation menu...

<ul id="navbar">
  <li><%= link_to_tagged_current("Home", { :action => "index" }) %></li>
  <li><%= link_to_tagged_current("About Us", { :action => "about" }) %></li>

If in the "about" action, it will render...

<ul id="navbar">
  <li><a href="/controller/index">Home</a></li>
  <li><a href="/controller/about" class="current">About Us</a></li>

...but if in the "index" action, it will render:

<ul id="navbar">
  <li><a href="/controller/index" class="current">Home</a></li>
  <li><a href="/controller/about">About Us</a></li>

Comments and changes to this ticket

  • Pratik

    Pratik June 12th, 2008 @ 10:12 AM

    • State changed from “new” to “invalid”

    I think this should stay plugin for now. You can also try to email core mailing list to see what other people think.


Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket