From c10a2d247576bff6be6500432e3cf8eb38cc2afd Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Sat, 1 Apr 2006 04:58:46 +0000 Subject: Teach Rails apps to only load gems of the same Rails version they were generated with. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/environments/boot.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'railties/environments') diff --git a/railties/environments/boot.rb b/railties/environments/boot.rb index 9fcd50fe3f..a57f0f46da 100644 --- a/railties/environments/boot.rb +++ b/railties/environments/boot.rb @@ -13,7 +13,12 @@ if File.directory?("#{RAILS_ROOT}/vendor/rails") require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" else require 'rubygems' - require 'initializer' + required_version = '<%= Rails::VERSION::STRING %>' + rails_gem = Gem.cache.search('rails', "=#{required_version}").first + unless rails_gem + STDERR.puts "Cannot find gem for Rails =#{required_version}. Install missing gem or change config/boot.rb." + end + require rails_gem.full_gem_path + '/lib/initializer' end Rails::Initializer.run(:set_load_path) -- cgit v1.2.3