Module: VestalVersions::Associations::AssociationCollection

Defined in:
lib/vestal_versions/associations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



19
20
21
22
23
24
# File 'lib/vestal_versions/associations.rb', line 19

def self.included(base) # :nodoc:
  base.class_eval do
    alias_method_chain :first, :reversion
    alias_method_chain :last, :reversion
  end
end

Instance Method Details

#first_with_reversion(*args) ⇒ Object



26
27
28
29
30
# File 'lib/vestal_versions/associations.rb', line 26

def first_with_reversion(*args)
  record = first_without_reversion(*args)
  revert_record(record) if record
  record
end

#last_with_reversion(*args) ⇒ Object



32
33
34
35
36
# File 'lib/vestal_versions/associations.rb', line 32

def last_with_reversion(*args)
  record = last_without_reversion(*args)
  revert_record(record) if record
  record
end