ActiveResource gem problem

Hi,

I'm trying to use ActiveResource with my Rails 1.2.3. I installed ARes 0.9.0 with the current command:

sudo gem install --version 0.9.0 activeresource --source http://gems.rubyonrails.org

I inserted "require" in my environment.rb like this:

require 'rubygems' require 'active_resource'

and without creating a ARes model, just lauching the server (mongrel), it fails with this error:

/opt/local/lib/ruby/gems/1.8/gems/activeresource-0.9.0/lib/active_resource/base.rb:34: undefined method `attr_accessor_with_default' for #<Class:ActiveResource::Base> (NoMethodError)         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'         from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'         from /opt/local/lib/ruby/gems/1.8/gems/activeresource-0.9.0/lib/active_resource.rb:37         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'          ... 30 levels...         from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from ./script/server:3

Does anyone has experienced this type of problem ?

Regards,

It requires edge rails.

> > Hi, > > I'm trying to use ActiveResource with my Rails 1.2.3. I installed ARes > 0.9.0 with the current command:

It requires edge rails.

Ok.

But in Rails Cookbook, they give recipes about the use of ARes for the 1.2 Rails version. So it should work with no?

No, not out of the box. More specifically, the trunk of ARes relies on some of the post-1.2 changes in Active Support as well. The example you ran into here is one of those cases.

I'm experimenting with an approach of maintaining a local fork of Active Resource where I copy-n-paste the Active Support code snippets into lib/active_resource.rb of my copy. So far, so good ... although it's hard to expect any guarantees that this will continue to work.

Craig McClanahan