module Saasable::Mongoid::ScopedDocument::ClassMethods

Public Instance Methods

index_with_saasable(spec, options = {}) click to toggle source
# File lib/saasable/mongoid/scoped_document.rb, line 47
def index_with_saasable(spec, options = {})
  index_without_saasable({saas_id: 1}.merge(spec), options)
end
validates_uniqueness_of(*args) click to toggle source
# File lib/saasable/mongoid/scoped_document.rb, line 39
def validates_uniqueness_of(*args)
  attributes = _merge_attributes(args)
  attributes[:scope] ||= []
  attributes[:scope] << :saas_id unless attributes[:scope].include?(:saas_id)

  validates_with(Mongoid::Validatable::UniquenessValidator, attributes)
end