ActiveResource Available as a Gem 9

Posted by ryan
at 9:30 AM on Thursday, April 26, 2007

In the past, whenever I’ve spoken to a group about ActiveResource, one of the questions that regularly comes up is if ActiveResource is available as a gem. Trying to install it from the svn tree is a little less than straight forward. With ARes now scheduled to be a part of Rails it will be installable as a gem. For now, though, prior to the official Rails release you can get ARes installed with:


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

(Thanks to DHH for pointing this out in my last post)

When Rails is released you will be able to use the more conventional:


gem install activeresource

tags: ruby, rubyonrails, REST

Comments

Leave a response

  1. Open WookieApril 26, 2007 @ 12:05 PM

    Awesome!

    I’m really looking forward to using this. I’ve got an app that this is perfect for.

  2. OkadaApril 26, 2007 @ 04:52 PM

    Do I have to be using Edge (or any specific version of Rails) on the client side to install ARes? Are there any dependencies on ActiveSupport or everething it needs is installed by the gem?

    Great news. Thanks!

  3. RyanApril 26, 2007 @ 05:59 PM

    Okada – if you’re installing the gems, ActiveResource and ActiveSupport are the only ones you should need to install (and trying a gem install activeresource will automatically pull down the dependencies for you).

    As far as needing to be on edge Rails on the client side – I’m not sure about that. I would guess that since the only potentially conflicting dependency is ActiveSupport you might be in the clear?

  4. Franco SellittoMay 02, 2007 @ 09:19 AM

    Hello everybody

    I’m trying to understand how to work with ActiveResource, but I cannot manage the installation. After gem install activeresource—source http://gems.rubyonrails.org I have now the gems activeresource (0.9.0.6552) activesupport (1.4.2.6552, 1.4.2.6548, 1.4.1, 1.3.1, 1.3.0, 1.2.5)

    When I try to open the console (./script/console) into my application and then just inspect the ActiveResource, I have an error message: “NameError: uninitialized constant ActiveResource”

    When I try with >> require ‘active_resource’ I have the following error message: “MissingSourceFile: no such file to load—active_resource”

    What I have to include in order to make it run?

    Thanks

  5. Franco SellittoMay 02, 2007 @ 01:01 PM

    I found the problem!

    I was working with a project already started with Rails 1.2.2 then I just updated the gems.

    Now I changed in config/environment.rb: RAILS_GEM_VERSION = ‘1.2.2’ to RAILS_GEM_VERSION = ‘1.2.3’. It seems work now.

  6. Franco SellittoMay 03, 2007 @ 08:14 AM

    Ops, the problem was not completely solved. With 1.2.3 I can start the script/console, but when I start the script/server (or event script/about) I have this error:

    /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6552/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method’: undefined method `load_plugin’ for class `Rails::Initializer’ (NameError)

    Rails 1.2.2 with ActiveSupport 1.4.1 works fine, but when I want to have ActiveResource, I need at least 1.2.3 and 1.4.2 that don’t start in proper way.

  7. jack dempseyMay 18, 2007 @ 12:03 PM

    I’ve played around with this some, and am curious if you actually got it working Franco. I’ve installed the beta gem which pulled down activesupport 1.4.2.6752. However, when trying to use things inside a rails 1.2.3 app, which ties specifically to activesupport 1.4.2, I get an activation error. Have you (or others) just hacked at things to get it working?

  8. Tyler RickMay 25, 2007 @ 05:16 PM

    Why do I get this error when I try to install it? ERROR: While executing gem … (NoMethodError) undefined method `source_index’ for #<hash:0xb7d89bc4> /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:81:in `source_index_hash’ /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:80:in `each’ /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:80:in `source_index_hash’ /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:91:in `specs_n_sources_matching’ /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:114:in `find_gem_to_install’ /usr/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:57:in `install’ /usr/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:277:in `execute’ /usr/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:239:in `each’ /usr/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:239:in `execute’ /usr/lib/ruby/site_ruby/1.8/rubygems/command.rb:70:in `invoke’ /usr/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:120:in `process_args’ /usr/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:91:in `run’ /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:30:in `run’ /usr/bin/gem:23

    gem install activeresource --source http://gems.rubyonrails.org --backtrace

    (sudo rm /usr/lib/ruby/gems/1.8/source_cache doesn’t help)

    Thanks

  9. David JonesAugust 03, 2007 @ 06:10 PM

    Thanks Ryan.

    I was trying to run my tests and kept getting “no such file to load—active_resource”.

    After running “gem install activeresource—source http://gems.rubyonrails.org” the problem was fixed!

Comment