lib/mongoid/tenancy.rb in mongoid-tenant-0.3.1 vs lib/mongoid/tenancy.rb in mongoid-tenant-0.3.3
- old
+ new
@@ -14,11 +14,11 @@
options[:validates] ||= { presence: true }
options[:index] ||= {}
validates key, { uniqueness: true }.merge(options[:validates])
-
index({ key => 1 }, { unique: true }.merge(options[:index]))
+ scope :active_tenants, -> { where(key.ne => nil) }
define_method(:tenant_key) do
send(key).to_s
end