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

Ticket #10926: posible_controllers_dir_load_fix.diff

File posible_controllers_dir_load_fix.diff, 2.0 kB (added by maxs, 6 months ago)

Controller paths array is sorted now before inferring possible controller names

  • actionpack/test/controller/routing_test.rb

    old new  
    21282128      RAILS_ROOT, RAILS_ROOT + '/app/controllers', RAILS_ROOT + '/vendor/plugins/bad_plugin/lib' 
    21292129    ] 
    21302130     
    2131     assert_equal ["admin/user", "plugin", "user"], ActionController::Routing.possible_controllers.sort 
     2131    assert_equal ["plugin", "admin/user", "admin", "user"], ActionController::Routing.possible_controllers 
    21322132  ensure 
    21332133    if true_controller_paths 
    21342134      ActionController::Routing.controller_paths = true_controller_paths 
     
    21522152      root, root + '/app/controllers', root + '/vendor/plugins/bad_plugin/lib' 
    21532153    ] 
    21542154     
    2155     assert_equal ["admin/user", "plugin", "user"], ActionController::Routing.possible_controllers.sort 
     2155    assert_equal ["plugin", "admin/user", "admin", "user"], ActionController::Routing.possible_controllers 
    21562156  ensure 
    21572157    ActionController::Routing.controller_paths = true_controller_paths 
    21582158    ActionController::Routing.use_controllers! true_possible_controllers 
  • actionpack/lib/action_controller/routing.rb

    old new  
    289289 
    290290          seen_paths = Hash.new {|h, k| h[k] = true; false} 
    291291          normalize_paths(paths).each do |load_path| 
    292             Dir["#{load_path}/**/*_controller.rb"].collect do |path| 
     292            Dir["#{load_path}/**/*_controller.rb"].sort!.collect do |path| 
    293293              next if seen_paths[path.gsub(%r{^\.[/\\]}, "")] 
    294294 
    295295              controller_name = path[(load_path.length + 1)..-1]