you are in: codestackercodes [RSS]current_action and current_controller helpers

current_action and current_controller helpers Delicious Email

create this helper and uses link_unless_current_controller

show/hide lines
   1  def current_action?(options)
   2    url_string = CGI.escapeHTML(url_for(options))
   3    params = ActionController::Routing::Routes.recognize_path(url_string, :method => :get)
   4    params[:controller] == @controller.controller_name && params[:action] == @controller.action_name
   5  end
   6  
   7  def current_controller?(options)
   8    url_string = CGI.escapeHTML(url_for(options))
   9    params = ActionController::Routing::Routes.recognize_path(url_string, :method => :get)
  10    params[:controller] == @controller.controller_name
  11  end
created by leozera — 07 January 2009 — get a short url — tags: helper rails ruby embed

Comments



We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image