1
0
Fork 0
mirror of https://github.com/pry/pry-rails.git synced 2022-11-09 12:36:03 -05:00

Fix find-route under Rails 3.0 and 3.1

This commit is contained in:
Ryan Fitzgerald 2015-02-01 16:04:11 -08:00
parent 441341c6c5
commit 520e39385d

View file

@ -54,7 +54,8 @@ class PryRails::FindRoute < Pry::ClassCommand
result << "Routes for " + text.bold(controller.camelize + "Controller") + "\n"
result << "--\n"
routes.each do |route|
result << "#{route.defaults[:action]} #{text.bold(verb_for(route))} #{route.path.spec}" + "\n"
spec = route.path.is_a?(String) ? route.path : route.path.spec
result << "#{route.defaults[:action]} #{text.bold(verb_for(route))} #{spec}" + "\n"
end
result << "\n"
end
@ -65,7 +66,7 @@ class PryRails::FindRoute < Pry::ClassCommand
end
def verb_for(route)
%w(GET PUT POST PATCH DELETE).find { |v| route.verb =~ v }
%w(GET PUT POST PATCH DELETE).find { |v| route.verb === v }
end
def single_action?(controller)