Skip to content

Instantly share code, notes, and snippets.

@rogercampos
Created November 18, 2010 08:39
Show Gist options
  • Save rogercampos/704781 to your computer and use it in GitHub Desktop.
Save rogercampos/704781 to your computer and use it in GitHub Desktop.
Simple snippet similar to current_page? but only maching the controller
def current_controller?(opts)
hash = Rails.application.routes.recognize_path(url_for(opts))
params[:controller] == hash[:controller]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment