Class: Eventifier::Ghost

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_from_object(object) ⇒ Object



9
10
11
# File 'app/models/eventifier/ghost.rb', line 9

def self.create_from_object object
  create :ghost_class => object.class.name, :ghost_id => object.id, :data_hash => object.serializable_hash
end

Instance Method Details

#ghostObject



13
14
15
16
17
18
19
# File 'app/models/eventifier/ghost.rb', line 13

def ghost
  klass = Object.const_get(ghost_class)
  ghost_object = klass.new data_hash
  ghost_object.id = ghost_id

  ghost_object
end