Permalink
Browse files

Fix Hash#index deprecated warning in 1.9.x [#4600 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
kossnocorp authored and josevalim committed May 15, 2010
1 parent 1a2d556 commit 3e84ea014e9f4d0f8d302c9bf8ad04240eec2804
Showing with 2 additions and 1 deletion.
  1. +2 −1 railties/lib/rails/tasks/routes.rake
@@ -3,7 +3,8 @@ task :routes => :environment do
Rails::Application.reload_routes!
all_routes = ENV['CONTROLLER'] ? Rails.application.routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Rails.application.routes.routes
routes = all_routes.collect do |route|
- name = Rails.application.routes.named_routes.routes.index(route).to_s
+ key_method = Hash.method_defined?('key') ? 'key' : 'index'
+ name = Rails.application.routes.named_routes.routes.send(key_method, route).to_s
reqs = route.requirements.empty? ? "" : route.requirements.inspect
{:name => name, :verb => route.verb.to_s, :path => route.path, :reqs => reqs}
end

0 comments on commit 3e84ea0

Please sign in to comment.