aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/tasks/routes.rake
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/tasks/routes.rake')
-rw-r--r--railties/lib/rails/tasks/routes.rake10
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake
index a0c953967c..adc005769f 100644
--- a/railties/lib/rails/tasks/routes.rake
+++ b/railties/lib/rails/tasks/routes.rake
@@ -11,7 +11,15 @@ task :routes => :environment do
reqs = route.requirements.dup
reqs[:to] = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/
- reqs = reqs.empty? ? "" : reqs.inspect
+
+ controller_action = "#{reqs[:controller]}##{reqs[:action]}"
+ constraints = reqs.except(:controller, :action)
+
+ reqs = controller_action == '#' ? '' : controller_action
+
+ unless constraints.empty?
+ reqs = reqs.empty? ? constraints.inspect : "#{reqs} #{constraints.inspect}"
+ end
{:name => route.name.to_s, :verb => route.verb.to_s, :path => route.path, :reqs => reqs}
end