public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
Refinement to avoid exceptions in traverse_to_controller

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4457 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Nicholas Seckar (author)
Sat Jun 17 22:25:17 -0700 2006
commit  4e2dcbfb150d8eda0c379946c1c0dbb5b7af714d
tree    a1ed7ac8a4d9d7fd581e6bc290b85625fcff33db
parent  a12aabc450a0ff19dfc2238b6fec9fdb09f868be
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *1.12.1* (April 6th, 2005)
0
 
0
+* Refinement to avoid exceptions in traverse_to_controller.
0
+
0
 * (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar]
0
 
0
 * Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
...
247
248
249
 
250
251
252
...
247
248
249
250
251
252
253
0
@@ -247,6 +247,7 @@ module ActionController
0
             
0
             if mod.const_defined? mod_name
0
               next_mod = mod.send(:const_get, mod_name)
0
+ next_mod = nil unless next_mod.is_a?(Module)
0
             else
0
               suffix = File.join(segments[start_at..index])
0
               $:.each do |base|
...
6
7
8
 
9
10
11
...
6
7
8
9
10
11
12
0
@@ -6,6 +6,7 @@ class NotAController
0
 end
0
 module Admin
0
   class << self; alias_method :const_available?, :const_defined?; end
0
+ SomeConstant = 10
0
   class UserController < Class.new(ActionController::Base); end
0
   class NewsFeedController < Class.new(ActionController::Base); end
0
 end
...
982
983
984
 
 
 
 
985
986
987
...
982
983
984
985
986
987
988
989
990
991
0
@@ -982,6 +982,10 @@ class ControllerComponentTest < Test::Unit::TestCase
0
     $:[0..-1] = load_path
0
   end
0
   
0
+ def test_traverse_should_not_trip_on_non_module_constants
0
+ assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(admin some_constant a))
0
+ end
0
+
0
 end
0
 
0
 end

Comments

    No one has commented yet.