ruby on rails - Sending notifications by schedule -


I need to send mail to the scheduled timings. I can specify two days in which the mail is sending mail.

I use when for this.

  class email & lt; ActiveRecord :: Base Confirms: Name, Specification: The Correct Final Category CreateEmails & lt; ActiveRecord :: migrations deff changes make_table: email | T | t.string: name t.string: value t.index: name, unique: true t.timestamps end end end set: output, "# {path} /log/cron_rails_app.log" every 5.minutes rake "delivery_campaign_status: ? Start ".: Price @campaigns = Campaign.where (notified: incorrect) End class NotifyEndedCampaigns DEF @end_day = Setting.find_by (name 'notify_day_from') started .where (" end_at & lt; ", Time.now + @end_day To_i.day) @ campaigns.each do | Campaign | CampaignEndedMailer.notify (campaign, @end_day) .deliver campaign.notified = true campaign.save requires end-end end 'notify_ended_campaigns' namespace: delivery_campaign_status desc start' nitify campaign last day ': Environment says' start Send Ended Campaign Notifications' end-end NotifyEndedCampaigns.new.start   

I made right?

After the

I would say no best practice, you should increase the logic of the actual investigation and in a different rake work When sending the email and whenever the rake work will be used to call the call in every 5 minutes, and for the rake work in the test model which fills the full notification criteria.

This will help you get started with a rake

I will suggest you to make a model in your model that emails to the company and the rest of the work is done in the rake work , Which usually resides in the / project / lib / work directory

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -