Skip to content

Instantly share code, notes, and snippets.

@rondy
Forked from cassiomarques/gist:2819167
Created May 28, 2012 13:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondy/2819263 to your computer and use it in GitHub Desktop.
Save rondy/2819263 to your computer and use it in GitHub Desktop.
Display your routes right at Rails Console, instead of waiting for rake to load your app
# This is part of my .pryrc.
# I put this at the section where I load Rails stuff, so I can use Pry instead of IRB
# for my Rails Console sessions
# Once this is loaded, just run the display_routes method from the console to see the same output that rake routes displays.
# I think it's better because I always leave a Rails console session running :)
require 'rails/application/route_inspector'
def display_routes
Rails.application.reload_routes!
routes = Rails.application.routes.routes
inspector = Rails::Application::RouteInspector.new
puts inspector.format(routes, ENV['CONTROLLER']).join "\n"
end
@brain64bit
Copy link

Hi i've got uninitialized constant Rails::Application::RouteInspector only in production mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment