Open bpdarlyn opened 6 years ago
Hi @bpdarlyn i am also using apartment in my application, its simple just create a rake task and get all tenants and perform any operation you want, this is how i have done it..
my_rake.rake
tenants = Tenant.all
tenants.each do |tenant|
begin
Apartment::Tenant.switch tenant.name
#perform any operation
rescue
end
end
And in schedule.rb file, just write this..
every :hour do
rake "my_app:my_rake_task"
end
to check your cron syntax use whenever
command in terminal
and for the last step update your crontab if you want to test it on local setup.
P.S
make sure you set you environment in schedule.rb
to development when testing on local
set :environment, 'development'
I hope this helps you..
I am using the gem apartment but I need run a scheduler by every tenant, whenever support this ?