Takehiro Mouri
Takehiro Mouri

Reputation: 670

Ruby on Rails - Trigger an event automatically on specific DateTime

I want to trigger an event, specifically send out an email and update attributes on some models, on a specific DateTime (which is a column in one of my models).

I have searched around but have not really found any solutions to this.

Is there any way of achieving this?

Upvotes: 3

Views: 1965

Answers (1)

Rohan S
Rohan S

Reputation: 223

You can use a queueing solution along with a scheduler.

Queueing solution: Resque with Redis backend https://github.com/resque/resque

Scheduling solution : https://github.com/resque/resque-scheduler

Resque.enqueue_at(5.days.from_now, SomeJob)

You can schedule a job to run at a particular date. Combine this with the ability to setup a schedule.

Say you trigger the first job on Jan 1st and want it to run every 30 days.

You can use a queuing solution to send out email asynchronously : something like Resque with a Redis backend.

Upvotes: 1

Related Questions