Rails Snippets

On February 25, 2009, in Development, Programmierung, Ruby and Rails, by tov

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 &lt;<eof>
USAGE: $0 RESELLER_ID
eof
end
app = ActionController::Integration::Session.new
app.get "/kunden/status_mail/#{id}"</eof>

This works fine from a Rails subdirectory and calls the same action like http://RAILSSITE/kunden/status_mail/ID

Tagged with:  

Leave a Reply

Your email address will not be published. Required fields are marked *