Module: Hindsight::ActMethod

Defined in:
lib/hindsight/has_hindsight.rb

Instance Method Summary collapse

Instance Method Details

#has_hindsight(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/hindsight/has_hindsight.rb', line 3

def has_hindsight(options = {})
  extend Hindsight::ClassMethods
  include Hindsight::InstanceMethods

  has_many :versions, :class_name => name, :primary_key => :versioned_record_id, :foreign_key => :versioned_record_id

  before_save :prepare_version
  after_create :init_versioned_record_id
end