RailsCron
I needed a way to send emails to users if certain data in the system had not been updated for 4 hours.
I thought that RailsCron would be the best solution developed by Kyle Maxwell. Unfortunatly his site and wiki was down. So I could not see how to use it correctly, as the readme was a bit vauge. So I thought I would post some simple code here to help some people on how to use RailsCron.
First of all I wanted to use ActsAsBackground on a Model Class. Here is the code :
class Comment < ActiveRecord::Base # This is the key thing. I am not sure why it does not use acts_as_background include ActsAsBackground # This defines what method you want to use background :deliver, :every => 1.minute def self.deliver #code here end end
What I was confused on was how to use acts as background. I managed to find a cached version of Kyle’s page and see it in action. I am sure there is a reason that it is not acts_as_background and why you need the include directive.
The next thing took me a while to figure out as well
. To actually use RaisCron you need to start it with a rake command like so :
rake cron_start
The rest of the comands are in the readme file. I hope this helps someone out there.
Hamza
1 comment so far
Leave a reply
your post is not clear enough to build a railscron
job. Will you please describe this in detail.
where do i find the readme file?????
thanks
ratul