From 520e39385dbdcf26be31bd38591457cff11d2a7b Mon Sep 17 00:00:00 2001 From: Ryan Fitzgerald Date: Sun, 1 Feb 2015 16:04:11 -0800 Subject: [PATCH] Fix find-route under Rails 3.0 and 3.1 --- lib/pry-rails/commands/find_route.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pry-rails/commands/find_route.rb b/lib/pry-rails/commands/find_route.rb index 05ebe87..3d9fb47 100644 --- a/lib/pry-rails/commands/find_route.rb +++ b/lib/pry-rails/commands/find_route.rb @@ -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)