Sha256: 225fb790c01ed6260fe879df7c86878aaf475c1c6e786163a729e435547ef102
Contents?: true
Size: 901 Bytes
Versions: 1
Compression:
Stored size: 901 Bytes
Contents
Rake::Task['db:mongoid:create_indexes'].clear Rake::Task['db:mongoid:remove_undefined_indexes'].clear namespace :db do namespace :mongoid do def tenancy_env ENV['TENANCY'] || fail("Provide a tenancy model: `TENANCY=Foo #{ARGV.join}`") end desc 'Create Mongoid indexes, tenant aware' task create_indexes: [:environment, :load_models] do Rake::Task['db:mongoid:create_indexes'].clear Object.const_get(tenancy_env).all.each do |t| puts "Tenant #{t}" t.tenancy! ::Mongoid::Tasks::Database.create_indexes end end desc 'Removes undefined Mongoid indexes, tenant aware' task remove_undefined_indexes: [:environment, :load_models] do Object.const_get(tenancy_env).all.each do |t| puts "Tenant #{t}" t.tenancy! ::Mongoid::Tasks::Database.remove_undefined_indexes end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-tenant-0.0.7 | lib/mongoid/tenant/tasks/tenant.rake |