Module: DCA::Storage

Extended by:
ActiveSupport::Concern
Included in:
Models::BaseModel
Defined in:
lib/dca/storage/storage.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroyObject



51
52
53
# File 'lib/dca/storage/storage.rb', line 51

def destroy
  self.class.storage.refresh self, :remove
end

#saveObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dca/storage/storage.rb', line 35

def save
  return false unless valid?

  current_state = state

  callback = "before_#{state}"
  send callback if self.respond_to? callback

  self.class.storage.refresh self, current_state

  callback = "after_#{state}"
  send callback if self.respond_to? callback

  current_state
end

#stateObject



31
32
33
# File 'lib/dca/storage/storage.rb', line 31

def state
  self.class.storage.state self
end