I want to resend confirmation instructions to the user if the user has not confirmed his account after sign up. I am using rails 4. I have this code but its not working.
def resend_confirmation_instructions
users = User.where('confirmed_at IS ?', nil)
users.each do |user|
if (user.created_at < (Date.today - 8))
end_date = (user.created_at.to_date)
start_date = Date.today()
date_diff = (start_date - end_date).to_i
if (date_diff == 3) or (date_diff == 6)
user.send_confirmation_instructions
end
end
end
end
I am using whenever gem to schedule this task every day.