Class: DesignHistory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/design_history.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.record(object) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/design_history.rb', line 5

def self.record(object)
  dh = DesignHistory.new
  dh.system_id = object.system_id
  dh.model_id = object.id
  dh.model = object.class.name
  dh.body = object.body
  dh.header = object.header if object.has_attribute?(:header) 
  dh.footer = object.footer if object.has_attribute?(:footer) 
  dh.user_id = object.user_id
  dh.updated_at = Time.now
  dh.save
end

Instance Method Details

#source_objectObject



18
19
20
# File 'app/models/design_history.rb', line 18

def source_object
  eval(self.model).find(self.model_id)
end