Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "RAILS_GEM_VERSION" setting do exactly?

Tags:

What is the purpose of the RAILS_GEM_VERSION setting in config/environment.rb? Is it supposed to stop your app from running under an unexpected version of Rails?

I just keep Rails updated to the latest release on my laptop and in production. Since I do that, can I comment out RAILS_GEM_VERSION or should I set it for some reason?

like image 277
Ethan Avatar asked Jan 25 '09 00:01

Ethan


1 Answers

Since you can have more than one version of Rails installed on your system (you can check with gem list rails), your application needs to know which version it is supposed to use. It won't be very clever just to "keep Rails updated to the latest release" and let the application use the newest version, since since new version of Rails could very easily break it (every new release means some changes to the API). This constant is irrelevant, however, if you "freeze" the version of Rails your app is build for, in the vendor folder. Btw. freezing Rails is a good practice, since your app is then more independent on the environment.

like image 148
Milan Novota Avatar answered Sep 28 '22 07:09

Milan Novota