Please take a look at Enhancement #9943 (2) and see what you think.
Here's the pitch for this little 5-line patch:
Even though boot.rb has the familiar "Don't change this file..."
message, sometimes I want to.
This would allow dynamic control over RAILS_GEM_VERSION and the
Version Specification passed to the RubyGems 'gem' method for the
rails gem. For example, users could test an app or plugin in a
Continuous Integration environment which performs automated regression
testing against various old Rails versions.
This patch would also to facilitate my GemInstaller gem, which
centrally manages the installation and loading of all gem dependencies
and versions, including Rails. Currently, I have to tell people (1)
to ignore the dire "Don't change this file..." warning and hack
boot.rb if they want to manage the Rails gem version along with the
rest of their gems. This is not compatible with Rails upgrades which
modify boot.rb, such as changeset  and ticket #9834; users will
have to re-modify boot.rb after upgrading.
So, whaddaya think? I'm happy to rewrite this patch however you would
like. I thought the simplest and most flexible approach would be to
mirror the config/initializers directory approach, which is done in
just 5 lines. If you don't like the extra config/preinitializers
directory, it could just look for a single hook file like
config/preinitializer.rb. This would be one less default dir in
/config, but it would be less flexible. For example, I couldn't just
have GemInstaller dump a provided geminstaller_preinitilizer.rb file
into config/preinitializers, I'd have to modify the single hook file.
If it's OK to have an extra dir in config, though, I think the current
approach is best
One other note. This patch is untested, because boot.rb would require
some refactoring to be testable, and I didn't want to overengineer
this patch. For an example of how boot.rb could be more made more
testable, see #9834. We could even pull out all of the logic from
boot.rb into a class, which would be much easier to test in isolation.
I'm definitely up for this if you are interested, but I wanted to do
The Simplest Thing That Could Possibly Work as the first cut.
-- Chad Woolley