I need a standalone script to load models every two hours from an
external source. I copied code from the original Ruby on Rails (RoR)
application that works fine. The problem is that on my system, even
the simplest request produces an error: it can’t find ActiveRecord.
Here’s the simplified script:
gem “activerecord” #new version of ‘gem_require’
‘mysql’, :database => ‘sample’,
:username => ‘root’, :password => ‘pass’, :socket => ‘/tmp/
Here’s the output:
ruby -w sample.rb
sample.rb:5: uninitialized constant ActiveRecord (NameError)
I get the same result putting the same code into irb.
But when I modify the last line of the script to simply “puts
$:” (i.e., print the list of loaded modules), here’s the list:
So ActiveRecord is sitting there. What am I doing wrong??