Module: Omnidata::Persistence

Extended by:
ActiveSupport::Concern
Defined in:
lib/omnidata/persistence.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroyObject



20
21
22
# File 'lib/omnidata/persistence.rb', line 20

def destroy
  self.class.destroy(id)
end

#saveObject



11
12
13
14
15
16
17
18
# File 'lib/omnidata/persistence.rb', line 11

def save
  if new_record?
    self.id = self.class.create(attributes)
  else
    self.class.update(id, attributes)
  end
  self
end