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

Changeset 4729

Show
Ignore:
Timestamp:
08/08/06 21:44:34 (2 years ago)
Author:
ulysses
Message:

Checkin forgotten add. Update const_missing handler to avoid double loading files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/dependencies.rb

    r4728 r4729  
    156156     
    157157    file_path = search_for_autoload_file(path_suffix) 
    158     if file_path # We found a matching file to load 
     158    if file_path #&& ! loaded.include?(file_path) # We found a matching file to load 
    159159      require_or_load file_path, qualified_name 
    160160      raise LoadError, "Expected #{file_path} to define #{qualified_name}" unless from_mod.const_defined?(const_name) 
  • trunk/activesupport/test/dependencies_test.rb

    r4728 r4729  
    301301  end 
    302302   
     303  def test_const_missing_should_not_double_load 
     304    with_loading 'autoloading_fixtures' do 
     305      require_dependency 'counting_loader' 
     306      assert_equal 1, $counting_loaded_times 
     307      ModuleFolder 
     308      assert_equal 1, $counting_loaded_times 
     309    end 
     310  end 
     311   
    303312end