On Thu, Apr 23, 2009 at 1:01 PM, Kane <[email protected]> wrote: > > I am a Rails newbie and trying to get a basic maintenance schedule > running. > > I have a function that currently runs in my app by clicking a link in > the admin site. > > I installed rufus and am trying to follow the example here: > http://www.intridea.com/2009/2/13/dead-simple-task-scheduling-in-rails?blog=company > > This is my task_scheduler.rb file in its entirety > > require 'rubygems' > require 'rufus/scheduler' > > scheduler = Rufus::Scheduler.start_new > > #scheduler.cron("0 12 * * *") do > scheduler.every("5s") do > Thread.new do > begin > Manage.run_temp_stats_processor() > rescue Exception => e > puts "something went wrong : #{e}" > end > end > > end > > with this I get: > something went wrong : uninitialized constant Manage > > This is for my manage_controller.rb > class ManageController < ApplicationController
Hi Kane, the mailing list for the rufus-scheduler is at http://groups.google.com/group/rufus-ruby 1) you don't need to wrap your code inside a new Thread, rufus-scheduler does it for you. 2) you need to let your script know about your "Manage" module, I see no "require 'manage'" or such. "uninitialized constant Manage" means "me, your script, does not know anything about this constant 'Manage' of yours" 3) if you're trying to call a method of a controller from an external script, that's wrong. Controller methods are meant to be called by Rails itself. It seems your Manage module is already somewhere else outside of the ManageController, which is good, way to go, simply "require" it. 4) learning Ruby before Ruby on Rails will save you lots of time. OK, I hope this helps. Please post your next question at http://groups.google.com/group/rufus-ruby Best regards, -- John Mettraux - http://jmettraux.wordpress.com --~--~---------~--~----~------------~-------~--~----~ you received this message because you are subscribed to the "ruote users" group. to post : send email to [email protected] to unsubscribe : send email to [email protected] more options : http://groups.google.com/group/openwferu-users?hl=en -~----------~----~----~----~------~----~------~--~---
