Daily Jobs in Rails

Hi railers,

I have a quick question - I think it will be answered fairly easily methinks.

What's the best practice (naming conventions, where to place in project etc) for creating a job to be ran every day?

For example - want to run a ruby script to grab an xml feed and persist it in a database.

Thanks

Andrew

Put the job in the model. then run it with script/runner, via cron or whatever.

script/runner -e production Foo.daily_task

That's bloody fantastic! Thank you.

You can find a couple alternative solutions here:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/b6accea9d78d6e2e/6d29aadec26fbbd3?hl=en&lnk=gst&q=mcintyre#6d29aadec26fbbd3

I suspect Andrew's solution at the bottom of that post is probably best. Better than mine yes:-)

good luck! Tim

That seems a better alternative. Didn't seem quite right in the model, and in the controller it's a bit out of place. Tasks sounds like what the thing is. A task :slight_smile: