Some small snippets of Rails/Ruby codes that I’d like to not forget…
I found an interesting site on the Web: http://matthall.wordpress.com/2006/12/06/how-to-execute-a-rails-controller-action-via-cron/
Tweaking it a bit:
require '../config/environment'
require 'pp'
id = ARGV[0]
if id.nil?
raise <
USAGE: $0 RESELLER_ID
eof
end
app = ActionController::Integration::Session.new
app.get "/kunden/status_mail/#{id}"
This works fine from a Rails subdirectory and calls the same action like http://RAILSSITE/kunden/status_mail/ID
