diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-16 11:22:58 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-16 11:22:58 -0700 |
commit | 296b1eef67d93658951e4d633bf44acca9a8540d (patch) | |
tree | 7e8d65ba506b26d0818280fe35c9b2429ed0ebdf /railties/lib/rails/tasks | |
parent | e98d747705b953a60c276a268513e388440772d3 (diff) | |
parent | 7b619f1d7b3d261918592d4a9144d4a5d335d4b0 (diff) | |
download | rails-296b1eef67d93658951e4d633bf44acca9a8540d.tar.gz rails-296b1eef67d93658951e4d633bf44acca9a8540d.tar.bz2 rails-296b1eef67d93658951e4d633bf44acca9a8540d.zip |
Merge pull request #2082 from htanata/rake_routes_formatting
Better formatting of rake routes (issue #1991)
Diffstat (limited to 'railties/lib/rails/tasks')
-rw-r--r-- | railties/lib/rails/tasks/routes.rake | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake index a0c953967c..0c26bcf790 100644 --- a/railties/lib/rails/tasks/routes.rake +++ b/railties/lib/rails/tasks/routes.rake @@ -10,8 +10,16 @@ task :routes => :environment do routes = all_routes.collect do |route| reqs = route.requirements.dup - reqs[:to] = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/ - reqs = reqs.empty? ? "" : reqs.inspect + rack_app = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/ + + endpoint = rack_app ? rack_app.inspect : "#{reqs[:controller]}##{reqs[:action]}" + constraints = reqs.except(:controller, :action) + + reqs = endpoint == '#' ? '' : endpoint + + 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 |