Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9573: action_pack_routing_sorts_possible_controllers.diff

File action_pack_routing_sorts_possible_controllers.diff, 1.3 kB (added by danger, 1 year ago)

test case + bugfix

  • actionpack/test/controller/routing_test.rb

    old new  
    19891989      RAILS_ROOT, RAILS_ROOT + '/app/controllers', RAILS_ROOT + '/vendor/plugins/bad_plugin/lib' 
    19901990    ] 
    19911991     
    1992     assert_equal ["admin/user", "plugin", "user"], ActionController::Routing.possible_controllers.sort 
     1992    assert_equal ["admin/user", "plugin", "user"], ActionController::Routing.possible_controllers 
    19931993  ensure 
    19941994    if true_controller_paths 
    19951995      ActionController::Routing.controller_paths = true_controller_paths 
  • actionpack/lib/action_controller/routing.rb

    old new  
    317317 
    318318          seen_paths = Hash.new {|h, k| h[k] = true; false} 
    319319          normalize_paths(paths).each do |load_path| 
    320             Dir["#{load_path}/**/*_controller.rb"].collect do |path| 
     320            Dir["#{load_path}/**/*_controller.rb"].sort.collect do |path| 
    321321              next if seen_paths[path.gsub(%r{^\.[/\\]}, "")] 
    322322 
    323323              controller_name = path[(load_path.length + 1)..-1]