Question

I am a beginner in ruby, and i have a problem using my ruby script, that work on my computer, on a server.

My problem is that i don't become to require 'rack/cors' and require 'grape'

On my computer it works, without using any trick. But on the server ruby is installed on home directory. I became to require cors using require '../ruby/gems/gems/rack-cors-0.2.7/lib/rack/cors', but it feels like it's dirty so i would like to know if there is a better way to do this.

I did not became to use RUBYLIB env variable or -I of ruby.

My final goal is to use rack, so using rackup to launch my server.

Was it helpful?

Solution

If you were using Bundler, none of this would be an issue.

It allows you to install gems into arbitrary locations, but more importantly, loads them from whatever location you've installed them in automatically.

OTHER TIPS

By adding new dir into $LOAD_PATH

$LOAD_PATH.unshift YOUR_RACK_PATH unless $LOAD_PATH.include? YOUR_RACK_PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top