diff options
author | Sam Ruby <rubys@intertwingly.net> | 2010-08-29 13:28:10 -0400 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-29 14:38:29 -0300 |
commit | 600cf8bebc29da3538032ea141d9881a5ead9b1f (patch) | |
tree | ba19d023df24170aa2174fed4f23197e433958f2 /railties/lib/rails/tasks | |
parent | 82b700a89deffb6526f7fbfd9942f1e723cad9a7 (diff) | |
download | rails-600cf8bebc29da3538032ea141d9881a5ead9b1f.tar.gz rails-600cf8bebc29da3538032ea141d9881a5ead9b1f.tar.bz2 rails-600cf8bebc29da3538032ea141d9881a5ead9b1f.zip |
Make rake routes gracefully handle routes with no name
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'railties/lib/rails/tasks')
-rw-r--r-- | railties/lib/rails/tasks/routes.rake | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake index 9db8b60969..02e22361e0 100644 --- a/railties/lib/rails/tasks/routes.rake +++ b/railties/lib/rails/tasks/routes.rake @@ -13,16 +13,16 @@ task :routes => :environment do reqs[:to] = route.app unless route.app.class.name.to_s =~ /^ActionDispatch::Routing/ reqs = reqs.empty? ? "" : reqs.inspect - {:name => route.name, :verb => route.verb.to_s, :path => route.path, :reqs => reqs} + {:name => route.name.to_s, :verb => route.verb.to_s, :path => route.path, :reqs => reqs} end routes.reject! { |r| r[:path] =~ %r{/rails/info/properties} } # Skip the route if it's internal info route - name_width = routes.map{ |r| r[:name].length if r[:name] }.max - verb_width = routes.map{ |r| r[:verb].length if r[:verb] }.max - path_width = routes.map{ |r| r[:path].length if r[:path] }.max + name_width = routes.map{ |r| r[:name].length }.max + verb_width = routes.map{ |r| r[:verb].length }.max + path_width = routes.map{ |r| r[:path].length }.max routes.each do |r| puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}" end -end
\ No newline at end of file +end |