# Can load gem with irb but application fails

**URL:** <https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603>\
**Category:** Rails\
**Created:** [October 23, 2008, 12:27pm UTC](https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603 "2008-10-23T12:27:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [October 23, 2008, 12:27pm UTC](https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603/1 "2008-10-23T12:27:12Z")

</div>

Hi-

I’m trying to load the blackbook gem. I had it working at one point  
and don’t recall how I broke it. Anyway, right now, I can load it in  
irb and I get ‘true’ (success). The app dies, however and I get this  
in the log:

MissingSourceFile (no such file to load – blackbook):  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active\_support/  
dependencies.rb:510:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/ dependencies.rb:355:in`new\_constants\_in’  
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active\_support/  
dependencies.rb:510:in `require’  
/app/controllers/friends\_controller.rb:4  
…

So, it sounds like irb is using one gem path and the application is  
using another. I’m sure the gem is there, and this is a hosted app so  
I don’t have root. (The app works fine on my dev machine).

Can someone push me in the right direction?

Thanks,  
Dino

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [October 23, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603/2 "2008-10-23T15:24:48Z")

</div>

It sounds like your app is relying on the gems installed on the  
production  
server. Instead, you should consider bundling your gems with your app.  
Good  
coverage of gem dependencies is here [  
[http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies](http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies)]  
and here [  
[#110 Gem Dependencies - RailsCasts](http://railscasts.com/episodes/110) ].

Regards,  
Craig

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [November 5, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603/3 "2008-11-05T13:36:19Z")

</div>

When you issue the original ‘rails’ command, to populate the  
directory, it seems to embed gem version numbers here and there. Try  
creating a virgin directory with and diffing the created files with  
the stuff in your directory. Especially the config and environment  
stuff.

Also see  
[http://wiki.rubyonrails.org/rails/pages/HowToUseMultipleGemRepositories](http://wiki.rubyonrails.org/rails/pages/HowToUseMultipleGemRepositories)

You can use multiple gem repositories at the same time that way. Your  
rails console should use the same gem version as your web app, so test  
it there first.

I don’t know anything about blackbook, never heard of it.

Fred 2

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [October 23, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/can-load-gem-with-irb-but-application-fails/151603/4 "2008-10-23T22:01:22Z")

</div>

On Oct 23, 9:23 am, “Craig D.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> It sounds like your app is relying on the gems installed on the production  
> server. Instead, you should consider bundling your gems with your app. Good

ahh, so there’s more to it than just the $GEM\_PATH and $GEM\_HOME env  
vars?
