Why can't I just do "RUBY_VERSION = 1.9.3" in config/environment.rb ?

People,

Most of my Rails apps are using Ruby v1.8.7 but I need to start using Ruby v1.9.3 for one app in particular and to start learning Rails 3.2. It seems if I could install Ruby v1.9.3 side by side with v1.8.7 on my Fedora 16 x86_64 server, I should be able to have something like this:

   "RUBY_VERSION = 1.9.3"

in an app's config/environment.rb file and everything would "just work" ?

I have messed around with RVM in the past trying to get system-wide installs to work with both Ruby versions but just got into trouble and was only ever able to get one version of Ruby working at once with Apache.

Suggestions?

Thanks,

Phil.

Phillip, this problem has already been solved: use RVM. Create a file called ".rvmrc" and put it into the root directory of your project, like this:

rvm use 1.9.2-p290

Whenever you switch into that project (in your terminal) RVM will automatically switch ruby versions.

To get your server to recognize a different ruby version is a little different.

Yea, I think with Passenger/Apache you can configure the PassengerRuby setting on your site to use the Ruby binary you specify. I don't think there's a way to configure it in the app itself. think about it, how would Ruby itself read the config file before determining which ruby binary to use? It's impossible--- catch 22, it has to be in the server's configuration

-Jason

Jason,

Phillip, this problem has already been solved: use RVM. Create a file called ".rvmrc" and put it into the root directory of your project, like this:

rvm use 1.9.2-p290

Whenever you switch into that project (in your terminal) RVM will automatically switch ruby versions.

I am aware of that but that is not what I need . .

To get your server to recognize a different ruby version is a little different.

Yea, I think with Passenger/Apache you can configure the PassengerRuby setting on your site to use the Ruby binary you specify. I don't think there's a way to configure it in the app itself.

Passenger v3.2 is supposed to be able to support multiple Rubies - I have sent Phusion a note about paid support for using the pre-release version.

think about it, how would Ruby itself read the config file before determining which ruby binary to use? It's impossible--- catch 22, it has to be in the server's configuration

Of course . . how about a ".rubyrc" in the root dir of the project that Ruby itself would look at? - I suppose even that would need some sort of Ruby pre-processing . .

Thanks,

Phil.