Module: ActiveRecord::Associations

Defined in:
activerecord/lib/active_record/associations.rb,
activerecord/lib/active_record/associations/association_proxy.rb,
activerecord/lib/active_record/associations/has_one_association.rb,
activerecord/lib/active_record/associations/has_many_association.rb,
activerecord/lib/active_record/associations/association_collection.rb,
activerecord/lib/active_record/associations/belongs_to_association.rb,
activerecord/lib/active_record/associations/has_one_through_association.rb,
activerecord/lib/active_record/associations/has_many_through_association.rb,
activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb,
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb

Overview

See ActiveRecord::Associations::ClassMethods for documentation.

Defined Under Namespace

Modules: ClassMethods Classes: AssociationCollection, AssociationProxy, BelongsToAssociation, BelongsToPolymorphicAssociation, HasAndBelongsToManyAssociation, HasManyAssociation, HasManyThroughAssociation, HasOneAssociation, HasOneThroughAssociation

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(base)



94
95
96
# File 'activerecord/lib/active_record/associations.rb', line 94

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

- (Object) clear_association_cache

Clears out the association cache



99
100
101
102
103
# File 'activerecord/lib/active_record/associations.rb', line 99

def clear_association_cache #:nodoc:
  self.class.reflect_on_all_associations.to_a.each do |assoc|
    instance_variable_set "@#{assoc.name}", nil
  end unless self.new_record?
end