def menu_entry(name, url)
content_tag(:li, link_to_unless_current_path(name, url), current_path?(url) ? { :class => "active" } : {} )
end
def current_path?(options)
url_string = CGI.unescapeHTML(url_for(options))
request = @controller.request
request_uri = request.request_uri.split('?').first
if url_string =~ /^\w+:\/\//
"#{request.protocol}#{request.host_with_port}#{request_uri}".start_with? url_string
else
request_uri.start_with? url_string
end
end
def link_to_unless_current_path(name, options = {}, html_options = {}, &block)
link_to_unless current_path?(options), name, options, html_options, &block
end