I have been having a strange problem with including active record
outside of rails when it works ok in rails 3.0.3.
When I do ‘gem list’, I get this:
actionmailer (3.0.9, 3.0.3)
actionpack (3.0.9, 3.0.3)
activemodel (3.0.9, 3.0.3)
activerecord (3.0.9, 3.0.3)
activeresource (3.0.9, 3.0.3)
activesupport (3.0.9, 3.0.3)
So then I tried the code below, but I get this error:
db-test2.rb:6:in `’: uninitialized constant Object::ActiveRecord
(NameErro
r)
require ‘rubygems’
gem ‘activerecord’, ‘= 3.0.3’
ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:host => “localhost”,
:pool => 5,
:encoding => ‘utf8’,
:reconnect => false,
:database => “univ_parse_dev”,
:user => “PZZ”,
:password => “PZZ”
)
class MsdsAttr < ActiveRecord::Base
end
attr = MsdsAttr.find(:first)