How to Include Gem in Different Path

Hi,

I just tried Ruby on Rails (with RailsInstaller 2.1.0) and it works fine on my PC. However, when I put this on the website, I got the following error message:

Could not find multi_json-1.3.6 in any of the sources (Bundler::GemNotFound)

The problem is that the website has multi_json 1.0.4. The website allows me to download my own gems, but after the process, it is located at /home/username/ruby/gems/gems/multi_json-1.3.6, while my rails app is located at /home/username/myapp.

What is the best way to fix this so that the rails at the website can find my multi_json gem? Thanks.

(The rails on the website is 3.1.3, while on the PC it is 3.2.1, and the website does not allow a shell access.)

Regards,

Bill

Hi Bill,

either you can-

include the path (where your gem is installed) into your system’s PATH variable.

OR

install the gem into specified location i.e.- /home/username/myapp

Thanks,

Himanshu

An app written for rails 3.2.1 will not run on 3.1.3, so you must also find a solution to that problem. A server provider that supports Rails must provide a mechanism for you to use the gems you need, but this will vary dependent on the tools used by that provider. You must ask the provider how to solve your problems. If the provider does not actively support rails then you need to move to a different provider. Heroku is used by many for rails deployment and is free for small applications.

Colin

Hi guys,

Thanks for your replies. I don't have shell access to the Ruby and gems on the website, so modifying PATH is very difficult. Also, I cannot modify where Ruby gems find their paths. I am wondering if there is a path that we can specify in the rails files themselves (which I can do).

So Rails 3.2.1 will not run on 3.1.3? Should I downgrade my PC rails version then?

I just checked the Heroku site but it is unclear what is provided for free (small) applications. For now, I am just trying Rails.

Regards,

Bill

Hi guys,

Thanks for your replies. I don't have shell access to the Ruby and gems on the website, so modifying PATH is very difficult. Also, I cannot modify where Ruby gems find their paths. I am wondering if there is a path that we can specify in the rails files themselves (which I can do).

So Rails 3.2.1 will not run on 3.1.3? Should I downgrade my PC rails version then?

No, you should use a provider that supports rails properly. The tutorial at railstutorial.org (which is free to use online) would give you a good introduction to rails, and includes deploying an app at heroku.

Colin

Colin Law wrote in post #1072752:

No, you should use a provider that supports rails properly. The tutorial at railstutorial.org (which is free to use online) would give you a good introduction to rails, and includes deploying an app at heroku.

Colin

Thanks for your pointer. I will check it out. I followed the video tutorial on railsinstaller.org, and they use Engine Yard, which I don't want to use as they provide only 500 hours free.

Regards,

Bill