Actually I need help about how can I run a background job.
This job needs to listen all events registered in database and send an email
when the dates match.
I'm found clockwork gem as an option to do this.
I have to create a worker that runs every minute and verifies if current
date/time is the same from the event in the database.
Is it a good alternative ?
Well you can tell us that. If it working well and was easy to
implement then yes.
I don't know how you have coded it but a suggestion is to put all the
logic in a method of one (or more) of the models and then just call
that from the worker. That way the code is easier to test using your
I would probably just have written a rake task and called it from
cron, but I have not tried the clockwork gem so maybe it is a good
alternative. Does it play well with rails? I notice that it has not
been updated for a year or so, but maybe that is not an issue.