Link_to_unless_current doesnt work with resources?

in my routes.rb i have

map.resources :reviews

then when i do

link_to_unless_current(“reviews”, reviews_path)

i get a link unless im at “/reviews”

my understanding was that link_to_unless_current should not display a
link for any of the RESTful routes…

i mean
/reviews/1 or /reviews/edit/1

both should NOT be links? right??

if not, whats the right way to get it to not link as long as im at
that resource regardless of whatever my action is??

using rails 2.1… if it makes a difference…

no. link_to_unless_current means make a link_to reviews_path
["/reviews"] unless that’s the current uri. you might be looking for
the functionality of:

link_to_unless controller_name == “reviews”, reviews_path

which will link to reviews path unless it is the current controller.


On Fri, Aug 8, 2008 at 10:41 AM, [email protected]

oh yeah. and be aware that a failed create request will use the
reviews_path uri and could potentially affect your styling/layout with
that. i usually override current_page? with a check for
and return false if is. hope that helps.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs