Rake Tasks are great. You can access your database through Rails to do whatever you want. In my case, I wanted to email fans on dazlus.com with any profile changes that may have occurred by their idols (the profile of which they have indicated they are a fan).
IE - If Bob adds a new photo, his fans get an email later in the day letting them know about it with a convenient link to go in and see it.
This is pretty easy - though a little tricky at Joyent to set up the cron job. Joyent is my service provider. To get cron job set up here, you need to do two commands: 1) cd to the app directory and 2) run the rake task.
To do this - a command like this works:
cd /path/to/rails/app && /usr/local/bin/rake RAILS_ENV=production mail:fan_newsYou have to cd to the rails app first. If not you will see permission denied errors.
I'm also using Cron + Rake to send me updates about the site - checking regularly to see if there are any broken pages and to send me an email if so. Very handy tool to know about.
you rock
ReplyDelete