I have a cron job running at pre-determined time. This cron job is a small Ruby script that loads the whole Rails environment and does some jobs. One of the job is to send a link to users. The link needs to be full qualified. Meaning, it should be something like http://ww.myapp.com/user/activate/asdfe234sv. The domain part in the URL is variable. The cron job could be running from dev or staging or production servers. How can I generate these URLs?
Named routes aren't allowed in this Ruby script. To get to routes I have to do something like: ::ActionController::Routing::Routes
But even with that I am not able to generate the link. I tried url_for(:controller => 'user', :action => 'activate) and that doesn't work either. Any ideas how I can do this?
At the moment I have hard-coded the domain part in the script file.