Problems with no method error with rufus scheduler

Hi,

I have a problem with rufus. I created a test.rb file in the /config/
initializers folder.

test.rb

require ‘rubygems’
require ‘rufus/scheduler’

scheduler = Rufus::Scheduler.start_new

scheduler.each ‘10s’ do
puts “hey see you in 10seconds!”
end

works fine so far.
Now I change it to:

test.rb

require ‘rubygems’
require ‘rufus/scheduler’

scheduler = Rufus::Scheduler.start_new

scheduler.each ‘10s’ do
recipe = Recipe.check_for_new_print_jobs
end

And here I get an error… etc. method check_for_new_print_jobs not
found.

The method is in the recipe controller

/app/controllers/recipe_controller.rb

class RecipeController < ApplicationController

def index
end

def show
end

def check_for_new_print_jobs
File.open(‘test_scheduler’, ‘a’) do |f1|
f1 << “Hey, I am still alive” + Time.now.to_s+ “\n”
end
end

ruby -v
ruby 1.8.6

rails -v
rails 2.3.5

Can anyone give me a hint? Is there something special to do, because I
am calling a method out of a initializer file?
Thank you very much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs