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

Changeset 2440

Show
Ignore:
Timestamp:
10/03/05 15:28:08 (3 years ago)
Author:
minam
Message:

Chain the const_missing hook to any previously existing hook so rails can play nicely with rake

Files:

Legend:

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

    r2369 r2440  
    11*SVN* 
     2 
     3* Chain the const_missing hook to any previously existing hook so rails can play nicely with rake 
    24 
    35* Clean logger is compatible with both 1.8.2 and 1.8.3 Logger.  #2263 [Michael Schuerig <michael@schuerig.de>] 
  • trunk/activesupport/lib/active_support/dependencies.rb

    r2218 r2440  
    179179 
    180180class Module #:nodoc: 
     181  # Rename the original handler so we can chain it to the new one 
     182  alias :rails_original_const_missing :const_missing 
     183 
    181184  # Use const_missing to autoload associations so we don't have to 
    182185  # require_association when using single-table inheritance. 
     
    190193      if Object.const_defined?(class_id) then return Object.const_get(class_id) else raise LoadError end 
    191194    rescue LoadError => e 
    192       raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e) 
     195      begin 
     196        rails_original_const_missing(class_id) 
     197      rescue Exception 
     198        raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e) 
     199      end 
    193200    end 
    194201  end