2008年6月2日星期一

cattr_accessor not found

I installed activeresouce using RubyGems. And I want to launch the tests:

ruby /var/lib/gems/1.8/gems/activeresource-2.0.2-/test/format_test.rb

But it didn't work, I've got an error:

./../../lib/active_resource/base.rb:150: undefined method `cattr_accessor' for ActiveResource::Base:Class (NoMethodError)
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from ./../../lib/active_resource.rb:38
from ./../abstract_unit.rb:4:in `require'
from ./../abstract_unit.rb:4
from load_test.rb:1:in `require'
from load_test.rb:1

So I googled it, and found this topic
http://www.ruby-forum.com/topic/59288
Before starting tests, run this command:

export RUBYOPT=-rubygems

And then:

ruby /var/lib/gems/1.8/gems/activeresource-2.0.2-/test/format_test.rb

Haha, it works, but I don't know how it works. :(

没有评论: