ActiveResource error message when using Basecamp Gem

Update: This problem has been resolved in version 0.0.4 of the basecamp gem. Using the Basecamp gem in Rails 3, I got the following error message when running rails server or rails console:

The 'activeresource' library could not be loaded. If you have RubyGems installed you can install ActiveResource by doing "gem install activeresource".

This has been logged as an issue on the basecamp-wrapper github page (see https://github.com/anibalcucco/basecamp-wrapper/issues#issue/2) but hasn't been fixed in the gem yet.

This is how I got it to work by creating a local copy of the gem in my applications vendor/gems directory and modifying the local copy to remove the error.

First run the command bundle show basecamp. This will show the where the gem is currently installed.

Under this directory there should be a readme and a lib/basecamp.rb file. Create a vendor/gems/basecamp directory in your application and copy these file into it. Make sure you keep the directory structure, i.e. the basecamp.rb file should still be under a lib subdirectory.

The result should end up looking like this:

Plugins directory

Now you can make the changes required to the local copy of the basecamp.rb file. There are two places (line 21 and line 25) where you need to change require 'activeresource' to require 'active_resource':

begin
 require 'active_resource'
 rescue LoadError
 begin
 require 'rubygems'
 require 'active_resource'
 rescue LoadError
 abort <<-ERROR
 The 'activeresource' library could not be loaded. If you have RubyGems installed you can install ActiveResource by doing "gem install activeresource".
 ERROR
 end
end

The final step is to update your Gemfile to use the local copy of the gem. Change the Gemfile entry for the basecamp gem to this:

gem 'basecamp', '0.0.2', :path => File.join(File.dirname(__FILE__), '/vendor/gems/basecamp')
Now run a bundle update to update the Gemfile.lock. When you run your application now it will be using the local copy of the gem.

When you deploy into production, make sure that Gemfile, Gemfile.lock and the vendor/gems directory are all copied across so that you will also be using the modified gem in production.