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

Changeset 252

Show
Ignore:
Timestamp:
12/22/04 13:54:44 (4 years ago)
Author:
david
Message:

Added Base#clear_association_cache to empty all the cached associations #347 [Tobias Luetke]

Files:

Legend:

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

    r249 r252  
    11*SVN* 
     2 
     3* Added Base#clear_association_cache to empty all the cached associations #347 [Tobias Luetke] 
    24 
    35* Added more informative exceptions in establish_connection #356 [bitsweat] 
  • trunk/activerecord/lib/active_record/associations.rb

    r237 r252  
    3333      super 
    3434      base.extend(ClassMethods) 
     35    end 
     36 
     37    # Clears out the association cache  
     38    def clear_association_cache #:nodoc: 
     39      self.class.reflect_on_all_associations.to_a.each do |assoc| 
     40        instance_variable_set "@#{assoc.name}", nil 
     41      end 
    3542    end 
    3643