Skip to content

Instantly share code, notes, and snippets.

@Orion98MC
Created February 23, 2011 15:56
Show Gist options
  • Save Orion98MC/840596 to your computer and use it in GitHub Desktop.
Save Orion98MC/840596 to your computer and use it in GitHub Desktop.
restful route spec query intereface
match '/restful_spec/:controller', :via => :get, :to => proc {|env|
routes = Rails.application.routes.routes.select{ |route| route.defaults[:controller] == env["action_dispatch.request.path_parameters"][:controller] }.collect {|route| {:verb => route.verb.to_s, :path => route.path}}
[
200,
{"Content-Type" => "text/html"},
[routes.to_json]
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment