rtfminc
rtfminc

Reputation: 6363

Rails - different versions on my machine

I am wondering about rails versions.

I am in a project directory:

Okay, so where is this rails v2.1.1? I thought maybe in vendor, but no, should there be? I know that my installed (v2.3.4.) rails is at /usr/bin/rails.

Someone clear this up for me?

Upvotes: 3

Views: 6227

Answers (3)

JasonTrue
JasonTrue

Reputation: 19599

There are several possibilities.

./config/environment.rb has a constant RAILS_GEM_VERSION that's used unless you override that value, and it generally indicates which version of rails your app was built with. When you run script/about, that constant value should show by default.

gem list rails will show you what versions are installed locally, and you can have several versions around at any given time.

Finally, Rails apps can "freeze" the current version of rails so that they can count on the right version of rails libraries for their app, by executing

rake rails:freeze:gems

You can undo that by running

rake rails:unfreeze

You can also update the config by typing rake rails:update, or freeze to a specific version with rake rails:freeze:edge RELEASE=2.2.2.

Upvotes: 4

EmFi
EmFi

Reputation: 23450

/usr/bin/rails is a wrapper for the project creation script of the version of rails installed. It's just an executable ruby script that uses Ruby Gems to select the correct version of rails.

Where the rails gems are installed depends on where your gems are installed.

To find out where the gems are stored run the following ruby statements. Either in irb or as executable script.

require 'rubygems'
puts Gem.path.join("\n")

It should print out at least two directories. One local directory in your home folder for gems installed without administrator privileges, and one global directory for gems installed with administrator privileges. Your rails gems will be in one of those folders.

On my system this outputs /usr/lib/ruby/gems/1.8 and ~/.gem/ruby/1.8

Upvotes: 0

Toms Mikoss
Toms Mikoss

Reputation: 9427

Rails is a ruby gem - you can see all installed versions by gem list rails. And it should be installed in your gems directory.

Upvotes: 3

Related Questions