Class: ActiveRecord::FixtureSet::ClassCache
- Inherits:
 - 
      Object
      
        
- Object
 - ActiveRecord::FixtureSet::ClassCache
 
 
- Defined in:
 - lib/active_record/fixtures.rb
 
Instance Method Summary collapse
- #[](fs_name) ⇒ Object
 - 
  
    
      #initialize(class_names, config)  ⇒ ClassCache 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ClassCache.
 
Constructor Details
#initialize(class_names, config) ⇒ ClassCache
Returns a new instance of ClassCache.
      449 450 451 452 453 454 455 456 457  | 
    
      # File 'lib/active_record/fixtures.rb', line 449 def initialize(class_names, config) @class_names = class_names.stringify_keys @config = config # Remove string values that aren't constants or subclasses of AR @class_names.delete_if do |klass_name, klass| !insert_class(@class_names, klass_name, klass) end end  | 
  
Instance Method Details
#[](fs_name) ⇒ Object
      459 460 461 462 463 464  | 
    
      # File 'lib/active_record/fixtures.rb', line 459 def [](fs_name) @class_names.fetch(fs_name) do klass = default_fixture_model(fs_name, @config).safe_constantize insert_class(@class_names, fs_name, klass) end end  |