Skip to content

Instantly share code, notes, and snippets.

@caifara
Created September 16, 2010 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caifara/582101 to your computer and use it in GitHub Desktop.
Save caifara/582101 to your computer and use it in GitHub Desktop.
# Usage in console:
# app.rinfo => list of all route helper methods (ending on path without the
# hash_for methods)
# app.rinfo "user" => same list, but only routes containing "user".
# app.rinfo "user", "edit" => same list, but only routes containing "user"
# and "edit".
class ActionDispatch::Integration::Session
def rinfo(*parts)
methods = self.methods.select { |m| m =~ /.*_path$/ && m[0..3] != "hash" }
parts.each do |part|
methods = methods.select{ |m| m.include?(part) }
end
ap methods.sort
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment