3

I've been trying to uninstall rails because it was on 4.1.0.rc1 and I wanted 4.0.0, so I ran

gem uninstall rails -v 4.1.0.rc1

And it said it was uninstalled successfully but typing

rails -v

still gives me 4.1.0.rc1

I tried running

gem cleanup

but it still is giving me the wrong version, I've quit the terminal and opened it back up and everything and am still getting the wrong version.

I just want to make sure that I am using the right version and everything is running smoothly. I've only been recently getting into ruby and learning how to install things in the terminal (I'm a recent mac convert) so all this stuff kind of wigs me out.

Jordan
  • 2,393
  • 4
  • 30
  • 60

1 Answers1

5

Look at the gemfile in your project.

It should have this line

gem 'rails', '4.0.0'

Go to your projects directory

and run

rails -v

This should return

Rails 4.0.0

If you do a rails -v outside any rails folder it show the newest version you have. But , inside a rails project folder it uses the version defined in the gem file.

When you greate a new rails project you can run

rails _<*version*>_ new <application_name>

in the case of 4.0.0

rails _4.0.0_ new myapp 

This will return the rails versions you have

gem list | grep rails

if this returns

rails (4.0.3, 4.0.0, 3.2.12)

and you run

gem uninstall railties -v 4.0.3

you go to back to rails 4.0.0 on the global system. But again in each rails project you be at whatever version that's specified in the gemfile.

Andreas Lyngstad
  • 4,887
  • 2
  • 36
  • 69
  • so is there a way I can have it always default to a certain version when running the new command? And do I need to have that version installed or does it install it at that directory? – Jordan Apr 01 '14 at 16:33