jondavidjohn
jondavidjohn

Reputation: 62392

gem not available, even after adding to gemfile and running bundle install

I'm making a simple task where I need to parse an XML Http response, all the http is working fine, and I have my xml string....

I'm trying to use the xml-simple gem.

I've gem install xml-simple

I've also added gem 'xml-simple' to the gemfile

Ran bundle install with success

but when I try to require 'xml-simple' in my rake task it fails saying no such file to load -- xml-simple...

What am I missing???

Upvotes: 5

Views: 2685

Answers (2)

htanata
htanata

Reputation: 36944

Bundler tries to load the gem by using the gem name as the require path (i.e. require 'xml-simple'). But in the case of the xml-simple gem, the path is xmlsimple, not xml-simple.

So in your Gemfile, use this instead:

gem 'xml-simple', :require => 'xmlsimple'

Upvotes: 8

Jeremy
Jeremy

Reputation: 4930

Gems sometimes have a different require path than the gem name, try either:

gem 'xml-simple', :require => 'xml/simple'

or

gem 'xml-simple', :require => 'xmlsimple'

or whatever the correct require path is to specify

Upvotes: 0

Related Questions