How to use a freshly updated Rails gem?

Hi there,

How do IÂ make my app pick up the new Rails gem that I have just updated?

I have:

  1. just updated rails from version 2.1.0 to version 2.3.2 (console:
    “rails -v” → “Rails 2.3.2”)
  2. in environment.rb set: “RAILS_GEM_VERSION = ‘2.3.2’ unless defined?
    RAILS_GEM_VERSION”
  3. restarted the server

Result:

Even if I
a) totally uncomment “RAILS_GEM_VERSION = ‘2.3.2’ unless defined?
RAILS_GEM_VERSION” (in environment.rb), or
b) uncomment only “unless defined? RAILS_GEM_VERSION” (in
environment.rb),
Eclipse tells me the same thing (after having restarted the server).

Plus: I haven’t found any system environment variable called “Rails” (or
similar), using “printenv” in the Linux console.

What’s going on here?
How can I make my app use the new 2.3.2 rails gem?

Thanks a lot for your help!
Tom

On Mar 18, 2:05 pm, Tom Ha [email protected] wrote:

Hi there,

How do I make my app pick up the new Rails gem that I have just updated?

Is rails vendored into your app ? (ie does vendor/rails exist ?)

Fred

Yes, I have a “rails” folder in “vendor”.

What’s the conclusion from this?

(And: should I have it elsewhere instead? If yes, where and why? And how
would I do that?)

  1. in environment.rb set: “RAILS_GEM_VERSION = ‘2.3.2’ unless defined?
    RAILS_GEM_VERSION”

rake rails:update

then run all your tests… (-;

PS:Â “rake rails:update” unfortunately didn’t change the situation…

Ok, got it working, here’s what the problem was:

  • you can have Rails either in “vendor” or elsewhere on your system,
    e.g. in “/usr/lib/ruby/gems/1.8/gems” (or in both places)
  • the file config/boot.rb checks if there is a version in “vendor” and
    prefers this one over the one that’s NOT included in your app

In my case,

  • I had different versions in both places, and
  • the one in “vendor” was the old one, so I just deleted it and my app
    now picks up the newer/updated one in “/usr/lib/ruby/gems/1.8/gems”

Thanks for your hint, Fred!

On 18 Mar 2009, at 14:21, Tom Ha wrote:

Yes, I have a “rails” folder in “vendor”.

What’s the conclusion from this?
if you have such a folder then your app uses the version of rails in
there and ignores any installed gems (you don’t even need the gems
installed at all)

Fred