Rails 3 / RVM - Acts_as_list compiled locally - Why Can't Ruby See This Gem?

Posted by rabbit on rails on Stack Overflow See other posts from Stack Overflow or by rabbit on rails
Published on 2011-03-09T00:35:51Z Indexed on 2011/03/09 8:10 UTC
Read the original article Hit count: 675

I cannot figure out why rails/ruby cannot see this gem, despite each telling me that the gem is visible. I compiled this gem locally from a github branch since the main version seems to be broken in Rails 3. Or perhaps I am missing something else entirely.

Ovid:lightserve dlipa$ gem list
*** LOCAL GEMS ***
..
acts_as_list (0.2.1)
..

And

Ovid:lightserve dlipa$ cat Gemfile
...
gem "acts_as_list", "0.2.1"
...

And

Ovid:lightserve dlipa$ bundle install
    ...
    Using acts_as_list (0.2.1)  
    Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed

But

Ovid:lightserve dlipa$ r c
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.1
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.6.0]
  - INSTALLATION DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
     - /Users/dlipa/.rvm/gems/[email protected]
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org/", "http://gems.github.com"]
  - REMOTE SOURCES:
     - http://rubygems.org/
     - http://gems.github.com
Loading development environment (Rails 3.0.5)
ruby-1.9.2-p180 :001 > require 'acts_as_list'
LoadError: no such file to load -- acts_as_list
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
    from (irb):1
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in `start'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in `start'
    from /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ruby-1.9.2-p180 :002 > 

And

Ovid:lightserve dlipa$ irb
ruby-1.9.2-p180 :001 > require 'acts_as_list'
LoadError: no such file to load -- acts_as_list
    from /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from (irb):1
    from /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
ruby-1.9.2-p180 :002 > 

Can anyone explain why this might be happening? I'd really appreciate it!

** UPDATE -- Response to Andrew Marshall's suggestion**

I changed Gemfile to read the gem directly from git, but it did not resolve the problem. Does this mean that there is a problem with this gem? The error message is not very helpful ;-)

Removed:

Ovid:lightserve dlipa$ bundle show acts_as_list
Could not find gem 'acts_as_list' in the current bundle.

Then added back via:

gem "acts_as_list", :git => "git://github.com/vpereira/acts_as_list.git"

Ovid:lightserve dlipa$ bundle install
Updating git://github.com/vpereira/acts_as_list.git
...

Same problem even though bundle show matches the commit on that page:

Ovid:lightserve dlipa$ bundle show acts_as_list
/Users/dlipa/.rvm/gems/ruby-1.9.2-p180/bundler/gems/acts_as_list-4cb76a8b198c

Ovid:lightserve dlipa$ irb
ruby-1.9.2-p180 :001 > require 'acts_as_list'
LoadError: no such file to load -- acts_as_list
    from /Users/dlipa/.rvm/rubies/ruby-1.9.2-..

I just looked in the gem and it appears there is no file called 'acts_as_list' in the gem. So it appears to be idiosyncratic, albeit poorly reported by Rails/Ruby.

The API appears to have changed to:

ruby-1.9.2-p180 :003 > require 'active_record/acts/list'
 => nil 
ruby-1.9.2-p180 :004 > ActiveRecord::Acts::List
 => ActiveRecord::Acts::List 

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby