module Mara::Model::Query

Methods to query for a model.

@author Maddie Schipper @since 1.0.0

Public Class Methods

included(klass) click to toggle source

@private

# File lib/mara/model/query.rb, line 23
def self.included(klass)
  klass.extend(ClassMethods)
end

Public Instance Methods

exist?() click to toggle source

Checks if a the model exists in the table?

@return [true, false]

# File lib/mara/model/query.rb, line 88
def exist?
  pk = partition_key
  sk = conditional_sort_key
  self.class.find(pk, sk).present?
rescue  Mara::Model::NotFoundError
  false
end