If you just want to manually run this, or run it from cron, you can use /script/runner and pass it the path to a script. It will execute the script within the rails environment so everything will be available to you. The script can be really simple if the methods are already defined in models or libraries. like:
In a model:
class Foo < ActiveRecord::Base def self.do_long_foo_thing do_something_long end end
Then in a script /tmp/my_script:
Foo.do_long_foo_thing
then /path/to/rails/app/script/runner /tmp/my_script
I created a site_scripts directory under my scripts directory to hold these, but you can put them wherever. I use them for cleaning sessions and various other tasks.
However, if this is something that needs to be initiated from a web page, but you want to background it, check out BackgroundDRB http://backgroundrb.rubyforge.org/.
Hope this helps.
Sy Ys wrote: