1
我想重新發送一封激活郵件給用戶,如果他們沒有在48小時內激活它。我使用每當寶石,但它不發送電子郵件。即使行動郵件工作正常,併發送一封電子郵件,當用戶註冊 schedule.rb每當寶石不發送電子郵件
set :environment, :development
every 1.minutes do
runner "user.resend_account_activation"
end
user_mailer.rb
def resend_account_activation
@user = User.where('activated = ?',false && 'activated_at < ?',48.hours.ago)
mail to: @user.email, subject: "You forgot to activate"
end
user.rb
def resend_account_activation
# @outdated_users = User.where('activated_at < ?',30.seconds.ago)
UserMailer.resend_account_activation.deliver_now!
end
I ñ我的CMD
# Begin Whenever generated tasks for: store
* * * * * /bin/bash -l -c 'cd /mnt/c/Sites/testApp && bin/rails runner -e production '\''user.resend_account_activation'\'''
# End Whenever generated tasks for: store
我不知道這個查詢。 'User.where('activated =?',false &&'activated_at <?',48.hours.ago)' –