Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I recently installed Rails 3.2.1 (Gem version 1.8.7) running on Ruby 1.9.3 on Ubuntu 11.10. I installed ruby, rails, and gem using rvm. I currently only have the one version installed. When I type "ruby -v" in a normal directory I see 1.9.3 as expected and when I type rails -v I see 3.2.1 as expected.

This allows me to type "rails new sample" to create a rails application called sample. If I cd into the "sample" directory though and type "rails server" it tells me rails is not installed. So I checked the $PATH variable and it is not what I expect to see. Here is the output as I currently see it.

enter image description here

If in the "sample" directory I type "rvm --default use 1.9.3", rails is once again recognized. Does anyone have any idea how this occurs or an idea of what to start searching for? Thanks in advance.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

First, this isn't really an answer as to why it has that, but rather a solution/workaround.

First, lets make a rails application:

jrg@discovery:~/code$ rails new sample

Then, we need to make a .rvmrc file for our application. More on why thats important over here, but the basic idea is that its isolated. Save this inside the rails application sample (so if its in ~/code, we need to save the .rvmrc in ~/code/sample/.rvmrc)

All the .rvmrc file needs to contain is something like this:

rvm --create 1.9.3@$project

Change $project to whatever you want, it doesn't matter.

Then, cd into ~/code/sample, and you'll be greeted with a scary warning:

enter image description here

Because you know whats in this one, you can safely type y for yes, although I highly recommend that you type v (for view) with any strange .rvmrc's - they can be a security risk, although I haven't seen any.

Now, run bundle install to install all your gems. Enjoy!

share|improve this answer
1  
Worked like a charm. Thanks –  Eric LaForce Mar 14 '12 at 10:38
    
@LaForce glad to help! –  jrg Mar 14 '12 at 11:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.