Module: VestalVersions::Associations

Defined in:
lib/vestal_versions/associations.rb

Overview

Allows associations to be automatically reverted_to a given instance method.

Defined Under Namespace

Modules: AssociationCollection, AssociationProxy

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vestal_versions/associations.rb', line 4

def self.extended(base) # :nodoc:
  base.class_eval do
    valid_keys_for_belongs_to_association               << :versioned
    valid_keys_for_has_and_belongs_to_many_association  << :versioned
    valid_keys_for_has_many_association                 << :versioned
    valid_keys_for_has_one_association                  << :versioned
  end

  ActiveRecord::Associations::AssociationProxy.send(:include, AssociationProxy::Reversion)
  ActiveRecord::Associations::AssociationProxy.send(:include, AssociationProxy)
  ActiveRecord::Associations::AssociationCollection.send(:include, AssociationProxy)
  ActiveRecord::Associations::AssociationCollection.send(:include, AssociationCollection)
end