Can load gem with irb but application fails


#1

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:inrequire’
/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:innew_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


#2

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]
and here [
http://railscasts.com/episodes/110 ].

Regards,
Craig


#3

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

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


#4

On Oct 23, 9:23 am, “Craig D.” 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?