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

Changeset 4457

Show
Ignore:
Timestamp:
06/18/06 05:25:17 (2 years ago)
Author:
ulysses
Message:

Refinement to avoid exceptions in traverse_to_controller

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/stable/actionpack/CHANGELOG

    r4456 r4457  
    11*1.12.1* (April 6th, 2005) 
     2 
     3* Refinement to avoid exceptions in traverse_to_controller. 
    24 
    35* (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar] 
  • branches/stable/actionpack/lib/action_controller/routing.rb

    r4456 r4457  
    248248            if mod.const_defined? mod_name 
    249249              next_mod = mod.send(:const_get, mod_name) 
     250              next_mod = nil unless next_mod.is_a?(Module) 
    250251            else 
    251252              suffix = File.join(segments[start_at..index]) 
  • branches/stable/actionpack/test/controller/fake_controllers.rb

    r3542 r4457  
    77module Admin 
    88  class << self; alias_method :const_available?, :const_defined?; end 
     9  SomeConstant = 10 
    910  class UserController < Class.new(ActionController::Base); end 
    1011  class NewsFeedController < Class.new(ActionController::Base); end 
  • branches/stable/actionpack/test/controller/routing_test.rb

    r4456 r4457  
    983983  end 
    984984   
     985  def test_traverse_should_not_trip_on_non_module_constants 
     986    assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(admin some_constant a)) 
     987  end 
     988   
    985989end 
    986990