Sha256: 94424187d329e164822344bf80411941f38c413f484d21e105ad707a2f890fec
Contents?: true
Size: 801 Bytes
Versions: 1
Compression:
Stored size: 801 Bytes
Contents
Rake::Task["db:mongoid:create_indexes"].clear Rake::Task["db:mongoid:remove_undefined_indexes"].clear namespace :db do namespace :mongoid do def get_tenancy ENV['TENANCY'] || fail("Provide a tenancy model: `TENANCY=Foo #{ARGV.join}`") end task :create_indexes => [:environment, :load_models] do Rake::Task["db:mongoid:create_indexes"].clear Object.const_get(get_tenancy).all.each do |t| puts "Tenant #{t}" t.tenancy! ::Mongoid::Tasks::Database.create_indexes end end task :remove_undefined_indexes => [:environment, :load_models] do Object.const_get(get_tenancy).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.5 | lib/mongoid/tenant/tasks/tenant.rake |