module Tire::Model::Persistence::Storage::InstanceMethods

Public Instance Methods

destroy() click to toggle source
# File lib/tire/model/persistence/storage.rb, line 51
def destroy
  run_callbacks :destroy do
    @destroyed = true
  end
  self.freeze
end
destroyed?() click to toggle source

TODO: Implement `new_record?` and clean up

# File lib/tire/model/persistence/storage.rb, line 60
def destroyed?; !!@destroyed; end
persisted?() click to toggle source
# File lib/tire/model/persistence/storage.rb, line 62
def persisted?; !!id;           end
save() click to toggle source
# File lib/tire/model/persistence/storage.rb, line 42
def save
  return false unless valid?
  run_callbacks :save do
    # Document#id is set in the +update_elasticsearch_index+ method,
    # where we have access to the JSON response
  end
  self
end
update_attribute(name, value) click to toggle source
# File lib/tire/model/persistence/storage.rb, line 32
def update_attribute(name, value)
  __update_attributes name => value
  save
end
update_attributes(attributes={}) click to toggle source
# File lib/tire/model/persistence/storage.rb, line 37
def update_attributes(attributes={})
  __update_attributes attributes
  save
end