namespace :mails do
desc "Send emails"
task :send_emails => :environment do
User.not_deleted.find_each do |user|
Notifier.confirm_about_paid_access(user.id).deliver
end
end
desc "Free subscription for users registered in 2011"
task :free_subscription_for => :environment, :year do |t, args|
year = args[:year]
users = User::registered_in(year)
end
end
显示错误: lib / tasks / mails.rake:10:语法错误,意外的keyword_do_block,expecting => 任务:free_subscription_for => :环境,:年份do | t,args |
语法代码有什么不对?
答案 0 :(得分:1)
试试这个,
async void btnSave_Click(object sender, EventArgs e)
{
// get string result of the operation
var result = await Task.Run(() => SaveTheData());
if (result != "OK")
{
msgBox = new CustomMessageBox(
"Файл добавлен в базу, строки " + result +
" не были добавлены по причине неверных входных данных",
"Уведомление");
msgBox.Show();
}
}
请注意namespace :mails do
desc "Send emails"
task :send_emails => :environment do
User.not_deleted.find_each do |user|
Notifier.confirm_about_paid_access(user.id).deliver
end
end
desc "Free subscription for users registered in 2011"
task :free_subscription_for, [:year] => :environment do |t, args|
year = args[:year]
users = User::registered_in(year)
end
end
任务的语法。
执行任务时,语法为:free_subscription_for
希望这有帮助!