Pergunta

I'm using several local gems in a rails 3 app that are loaded from vendor/gems. Here's an example of one from the Gemfile:

gem 'foo', '1.3.9', :path => 'vendor/gems'

When I try to run tests (i.e., bundle exec rake test) or launch the built-in server (i.e., rails s), Rails crashes with "uninitialized constant Foo (NameError)". Only the locally loaded gems cause this problem. Running "gem list" or "bundle exec gem list" shows the gems present with their correct version. Any ideas as to why these gems are not being loaded properly by Rails?

Foi útil?

Solução

The path is incorrect, it should be the full path of the gem. Like this

gem 'foo', '1.3.9', :path => 'vendor/gems/foo'

Otherwise it can't be found and loaded.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top