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

Changeset 5023

Show
Ignore:
Timestamp:
09/05/06 22:36:28 (2 years ago)
Author:
ulysses
Message:

Equate Kernel.const_missing with Object.const_missing. Fixes #5988.

Files:

Legend:

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

    r4910 r5023  
    11*SVN* 
     2 
     3* Equate Kernel.const_missing with Object.const_missing. Fixes #5988. [Nicholas Seckar] 
    24 
    35* Add ApplicationController special case to Dependencies. [Nicholas Seckar] 
  • trunk/activesupport/lib/active_support/dependencies.rb

    r4910 r5023  
    207207  def load_missing_constant(from_mod, const_name) 
    208208    log_call from_mod, const_name 
     209    if from_mod == Kernel 
     210      if ::Object.const_defined?(const_name) 
     211        log "Returning Object::#{const_name} for Kernel::#{const_name}" 
     212        return ::Object.const_get(const_name) 
     213      else 
     214        log "Substituting Object for Kernel" 
     215        from_mod = Object 
     216      end 
     217    end 
    209218     
    210219    # If we have an anonymous module, all we can do is attempt to load from Object. 
  • trunk/activesupport/test/dependencies_test.rb

    r4910 r5023  
    421421  end 
    422422   
     423  def test_const_missing_on_kernel_should_fallback_to_object 
     424    with_loading 'autoloading_fixtures' do 
     425      kls = Kernel::E 
     426      assert_equal "E", kls.name 
     427      assert_equal kls.object_id, Kernel::E.object_id 
     428    end 
     429  end 
     430   
    423431end