lib/saasable/mongoid/scoped_document.rb in saasable-5.0.2 vs lib/saasable/mongoid/scoped_document.rb in saasable-5.0.3

- old
+ new

@@ -8,11 +8,11 @@ # Default scope default_scope ->{ Saasable::Mongoid::SaasDocument.active_saas ? where(saas_id: Saasable::Mongoid::SaasDocument.active_saas._id) : all } # Indexes index({saas_id: 1}) - index({saad_id: 1, _id: 1}) + index({saad_id: 1, _id: 1}, unique: true) class << self alias_method_chain :index, :saasable end end @@ -34,10 +34,9 @@ validates_with(Mongoid::Validatable::UniquenessValidator, attributes) end def index_with_saasable(spec, options = {}) - index_without_saasable(spec, options.merge({unique: false})) - index_without_saasable({saas_id: 1}.merge(spec), options) unless spec.include?(:saas_id) + index_without_saasable({saas_id: 1}.merge(spec), options) end end end