On my web host's system, installing and using gems seems to require installing my own copy of ruby. With their help on a forum, I've gotten that done. I'm trying to use a particular gem (called Image Science) in a Rails app.
At this point, if I open irb
and type the following, this is what I get:
require 'rubygems' #true
require 'image_science' #LoadError: libfreeimage.so.3: cannot open shared
#object file: No such file or directory (etc)....
On the host's advice, I go back to bash and type this:
export LD_LIBRARY_PATH=~/ruby1.8/lib
That command allows irb to require image_science
- it returns 'true.' As I understand it, it's saying, "hey, also look in this directory for gems."
The problem is that this doesn't change what my Ruby scripts can access. (It also only persists for the session, but I suppose I can add it to my .bashrc
.) In my Rails app, I still get an error if I try to require that gem.
So I've got two questions:
- How do I make this gem available to my Ruby scripts - specifically, a Rails model file?
- Should I even need to put the "require" command in the model file, or is there some other way that the gem should get loaded?