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

Changeset 4910

Show
Ignore:
Timestamp:
09/02/06 21:13:30 (2 years ago)
Author:
ulysses
Message:

Add ApplicationController special case to Dependencies.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r4900 r4910  
    11*SVN* 
     2 
     3* Add ApplicationController special case to Dependencies. [Nicholas Seckar] 
    24 
    35* Don't pad remaining places with in_groups_of if specified padding value is false. [Marcel Molina Jr.] 
  • trunk/activesupport/lib/active_support/dependencies.rb

    r4885 r4910  
    124124    path = $1 if path =~ /\A(.*)\.rb\Z/ 
    125125    expanded_path = File.expand_path(path) 
     126     
    126127    bases.collect do |root| 
    127128      expanded_root = File.expand_path root 
     
    132133      next if nesting.blank? 
    133134       
    134       nesting.camelize 
    135     end.compact.uniq 
     135      names = [nesting.camelize] 
     136       
     137      # Special case: application.rb might define ApplicationControlller. 
     138      names << 'ApplicationController' if nesting == 'application' 
     139       
     140      names 
     141    end.flatten.compact.uniq 
    136142  end 
    137143   
  • trunk/activesupport/test/dependencies_test.rb

    r4837 r4910  
    405405      assert ! Dependencies.autoloaded?(ModuleFolder) 
    406406       
    407       ModuleFolder::NestedClass 
     407      1 if ModuleFolder::NestedClass # 1 if to avoid warning 
    408408      assert ! Dependencies.autoloaded?(ModuleFolder::NestedClass) 
    409409    end 
     
    413413  end 
    414414   
     415  def test_application_should_special_case_application_controller 
     416    with_loading 'autoloading_fixtures' do 
     417      require_dependency 'application' 
     418      assert_equal 10, ApplicationController 
     419      assert Dependencies.autoloaded?(:ApplicationController) 
     420    end 
     421  end 
     422   
    415423end