lib/dynamoid/persistence.rb
def delete
      options = range_key ? {:range_key => dump_field(self.read_attribute(range_key), self.class.attributes[range_key])} : {}

      # Add an optimistic locking check if the lock_version column exists
      if(self.class.attributes[:lock_version])
        conditions = {:if => {}}
        conditions[:if][:lock_version] =
          if changes[:lock_version].nil?
            self.lock_version
          else
            changes[:lock_version][0]
          end
        options[:conditions] = conditions
      end
      Dynamoid.adapter.delete(self.class.table_name, self.hash_key, options)
    rescue Dynamoid::Errors::ConditionalCheckFailedException
      raise Dynamoid::Errors::StaleObjectError.new(self, 'delete')
    end
# Delete this object from the datastore.
#
# @since 0.2.0
Delete this object from the datastore.
Delete this object from the datastore .
def delete
      options = range_key ? {:range_key => dump_field(self.read_attribute(range_key), self.class.attributes[range_key])} : {}
      if(self.class.attributes[:lock_version])
        conditions = {:if => {}}
        conditions[:if][:lock_version] =
          if changes[:lock_version].nil?
            self.lock_version
          else
            changes[:lock_version][0]
          end
        options[:conditions] = conditions
      end
      Dynamoid.adapter.delete(self.class.table_name, self.hash_key, options)
    rescue Dynamoid::Errors::ConditionalCheckFailedException
      raise Dynamoid::Errors::StaleObjectError.new(self, 'delete')
    end
def delete options = range_key ? { :range_key => dump_field ( self . read_attribute ( range_key ) , self . class . attributes [ range_key ] ) } : { } if ( self . class . attributes [ :lock_version ] ) conditions = { :if => { } } conditions [ :if ] [ :lock_version ] = if changes [ :lock_version ] . nil? self . lock_version else changes [ :lock_version ] [ 0 ] end options [ :conditions ] = conditions end Dynamoid . adapter . delete ( self . class . table_name , self . hash_key , options ) rescue Dynamoid :: Errors :: ConditionalCheckFailedException raise Dynamoid :: Errors :: StaleObjectError . new ( self , 'delete' ) end
Delete this object from the datastore.
Delete this object from the datastore .
# Add an optimistic locking check if the lock_version column exists
since
None