I'm trying to use ActiveRecord outside of Rails and with Ruby 1.9. I kept getting an error
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:394:in `': undefined method `cattr_accessor' for ActiveRecord::Base:Class (NoMethodError)
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:391:in `'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:4:in `'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record.rb:34:in `require'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record.rb:34:in `'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/activerecord.rb:1:in `require'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/activerecord.rb:1:in `'
from SimpleTest.rb:2:in `require'
from SimpleTest.rb:2:in `'
so and undefined method cattr_accessor in ActiveRecord::Base.
Trying the same code in 1.8 worked fine. After much searching I discovered that ActiveSupport had to be installed. This looked like it was installed when I installed ActiveRecord, but it possibly wasn't a complete install.
so after a
sudo gem install ActiveSupprt
I'm good to go
Posted
Dec 12 2008, 11:51 AM
by
kevin-jones