Module: SuperModel::Scriber::Model::ClassMethods

Defined in:
lib/supermodel/scriber.rb

Instance Method Summary collapse

Instance Method Details

#record(type, data = nil) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/supermodel/scriber.rb', line 70

def record(type, data = nil)
  ::Scriber.record(
    :klass => self, 
    :type => type, 
    :data => data
  )
end

#scribe_play(type, data) ⇒ Object

:nodoc:



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/supermodel/scriber.rb', line 57

def scribe_play(type, data) #:nodoc:
  Observer.disable do
    case type
    when :create  then create(data)
    when :destroy then destroy(data)
    when :update  then update(data)
    else
      method = "scribe_play_#{type}"
      send(method) if respond_to?(method)
    end
  end
end