Skip to content

Commit 6cabc9a

Browse files
committed
Add some comments related to Hash method check.
1 parent 2dc1402 commit 6cabc9a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

railties/lib/rails/tasks/routes.rake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ task :routes => :environment do
33
Rails::Application.reload_routes!
44
all_routes = ENV['CONTROLLER'] ? Rails.application.routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Rails.application.routes.routes
55
routes = all_routes.collect do |route|
6+
# TODO: The :index method is deprecated in 1.9 in favor of :key
7+
# but we don't have :key in 1.8.7. We can remove this check when
8+
# stop supporting 1.8.x
69
key_method = Hash.method_defined?('key') ? 'key' : 'index'
710
name = Rails.application.routes.named_routes.routes.send(key_method, route).to_s
811
reqs = route.requirements.empty? ? "" : route.requirements.inspect

0 commit comments

Comments
 (0)