Module: PaperTrail::ClassMethods

Defined in:
lib/paper_trail/has_paper_trail.rb

Instance Method Summary collapse

Instance Method Details

#has_paper_trailObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/paper_trail/has_paper_trail.rb', line 9

def has_paper_trail
  send :include, InstanceMethods
  
  cattr_accessor :paper_trail_active
  self.paper_trail_active = true

  has_many :versions, :as => :item, :order => 'created_at ASC, id ASC'

  after_create  :record_create
  before_update :record_update
  after_destroy :record_destroy
end

#paper_trail_offObject



22
23
24
# File 'lib/paper_trail/has_paper_trail.rb', line 22

def paper_trail_off
  self.paper_trail_active = false
end

#paper_trail_onObject



26
27
28
# File 'lib/paper_trail/has_paper_trail.rb', line 26

def paper_trail_on
  self.paper_trail_active = true
end