Module: Tableless::Persistence

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroyObject



26
27
28
29
30
# File 'lib/tableless/persistence.rb', line 26

def destroy
  @_trigger_destroy_callback = true
  @destroyed = true
  reload and freeze
end

#reloadObject



15
16
17
18
19
# File 'lib/tableless/persistence.rb', line 15

def reload(*)
  @attributes = self.class.new.instance_variable_get('@attributes')
  @new_record = false
  self
end

#update(attributes) ⇒ Object



21
22
23
24
# File 'lib/tableless/persistence.rb', line 21

def update(attributes)
  assign_attributes(attributes)
  save
end