Gadi A
Gadi A

Reputation: 3539

Rails - the newest gem is installed but the applicaiton is old

I'm working on Bluehost. I installed the 3.2.8 gem of rails, and now I get this:

> gem list --local | grep rails
rails (3.2.8)

But:

rails --version
Rails 2.3.11

How can I make the "rails" command use the latest gem? I guess it has something to do with my $PATH variable but I'm pretty much clueless about it.

Also, the gem and rails command give rise to some errors that look like this:

Invalid gemspec in [XXX]: invalid date format in specification: "YYY"

I'm not sure if that's connected (and I'm wondering what causes such errors anyway).

Upvotes: 1

Views: 553

Answers (1)

Isaac Betesh
Isaac Betesh

Reputation: 3000

Try running this command:

curl -L https://get.rvm.io | bash -s stable --ruby --rails

What it does is install RVM, which maintains separate gems for each version of Ruby installed. The --ruby and --rails arguments tell it to install ruby and rails while installing RVM. RVM installation automatically updates $PATH and any other necessary environment variables.

At the end of installation, it should prompt you to run:

source ~/.rvm/scripts/rvm

which will make those environment variable changes effective immediately. Alternatively, you can log out and then log right back in.

Run rails -v and ruby -v at that point, and you should see them pointing to the new version. Run bundle install from your RoR app's directory and all the gems you need should install in ~/.rvm/gems/ruby-/gems.

At that point, you can delete/uninstall any gems/rails/ruby from before installing RVM.

EDIT on 10/17/2012: Nevermind my answer. Even though it might be possible to get Rails 3.x running with the currently installed Ruby 1.8 (see this Stackoverflow question), you won't be able to run Ruby 1.9.x using Bluehost Shared Hosting. Your only choice (for now) is VPS Hosting.

The reason is that Passenger Phusion is tied to the version of Ruby installed in /usr/lib, which you can't change without root access. Even though you can install any version of Ruby with RVM, you won't get Passenger to talk to it and therefore your rails project won't use its gems.

Upvotes: 1

Related Questions