My app has a navigation bar with options:-
    "create post", "Show posts owned by me", "Show All posts"
But of I navigate to the page "show posts owned by me", the navigation bar should no longer 
display the option "show posts owned by me". Is the any api such as current_url_path so that
I can compare current_url_path api's output with "desired_url_check_path". and modify the view output accordingly.
views:
21answers:
2
                
                A: 
                
                
              
            Hey Saran. Yes, this is a helper I put in my application_helper.rb :
def main_nav_select(name, url)
  url = params[:q].blank? ? url : "#{url}?q=#{params[:q]}"
  if current_page? url
    content_tag(:li, "#{link_to(name, url)}", :class => 'selected')
  else
    content_tag(:li, "#{link_to(name, url)}")
  end
end
The real catch here is curent_page? url
I implement it like so :
= main_nav_select 'Main Page', admin_banners_path
                  Trip
                   2010-10-17 19:30:32
                
              
                +1 
                A: 
                
                
              
            There is the link_to_unless_current function:
<%=
   link_to_unless_current("Show posts owned by me", { :controller => "posts", :action => "index" }) do
      # Whatever code you want to occur
   end
%>
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to_unless_current
You should also look at the link_to_unless function.
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to_unless
                  Laz
                   2010-10-17 20:00:33