Rails 3 - rails runner doesn't work here

Hi,

I'm currently playing with Rails 3 (I'm new to rails, coming from PHP background). Everything works good so far, until yesterday, when I tried to setup a cronjob.

The most common way to starting regular jobs seems to be using "rails runner", right? So, as a test I've created a class "Mytest" in /vendor/ mytest.rb:

class Mytest   def self.hello      "hello world"   end end

Now, when I try to run this method in rails runner like:

shell# rails runner "puts Mytest.hello"

I get this response:

====== snap ========== /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/railties-3.0.0.beta/ lib/rails/commands/runner.rb:45: (eval):1: uninitialized constant Mytest (NameError)         from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/ railties-3.0.0.beta/lib/rails/commands.rb:60:in `eval'         from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/ railties-3.0.0.beta/lib/rails/commands/runner.rb:45         from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/ railties-3.0.0.beta/lib/rails/commands.rb:60:in `require'         from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/ railties-3.0.0.beta/lib/rails/commands.rb:60         from /private/tmp/testapp/script/rails:10:in `require'         from /private/tmp/testapp/script/rails:10

Hm, seems to be a problem in the older rails beta (the one you install with 'gem install rails --pre'). With rails -v => Rails 3.0.0.beta1 the error disappears :wink:

Regards Christian