Files
nairobi/lib/tasks/budgets.rake
Javi Martín fe9463cb5f Allow specifying the tenant in budget tasks
The `budgets📧selected` and `budgets📧unselected` tasks are
supposed to be run manually because they only make sense at a specific
point during the life of a budget.

However, they would only run on the default tenant, and it was
impossible to run them on a different tenant.

So we're introducing an argument in the rake task accepting the name of
the tenant whose users we want to send emails to.
2022-11-09 18:19:20 +01:00

14 lines
451 B
Ruby

namespace :budgets do
namespace :email do
desc "Sends emails to authors of selected investments"
task :selected, [:tenant] => :environment do |_, args|
Tenant.switch(args[:tenant]) { Budget.current.email_selected }
end
desc "Sends emails to authors of unselected investments"
task :unselected, [:tenant] => :environment do |_, args|
Tenant.switch(args[:tenant]) { Budget.current.email_unselected }
end
end
end