aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-04-01 04:58:46 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-04-01 04:58:46 +0000
commitc10a2d247576bff6be6500432e3cf8eb38cc2afd (patch)
treebcaafd650f0a06d8e75ac0610083e7a1f3d75e8f /railties
parent3f049b0b6b5a338786c3dfafb31edf937f4ecb13 (diff)
downloadrails-c10a2d247576bff6be6500432e3cf8eb38cc2afd.tar.gz
rails-c10a2d247576bff6be6500432e3cf8eb38cc2afd.tar.bz2
rails-c10a2d247576bff6be6500432e3cf8eb38cc2afd.zip
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
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/environments/boot.rb7
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb2
3 files changed, 9 insertions, 2 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 99fcd06c3b..3e661e527b 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Teach Rails apps to only load gems of the same Rails version they were generated with. [Nicholas Seckar]
+
* Added expiration settings for JavaScript, CSS, HTML, and images to default lighttpd.conf [DHH]
* Added gzip compression for JavaScript, CSS, and HTML to default lighttpd.conf [DHH]
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)
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 1211b512d7..b1f8942652 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -43,7 +43,7 @@ class AppGenerator < Rails::Generator::Base
m.template "configs/apache.conf", "public/.htaccess"
# Environments
- m.file "environments/boot.rb", "config/boot.rb"
+ m.template "environments/boot.rb", "config/boot.rb"
m.file "environments/environment.rb", "config/environment.rb"
m.file "environments/production.rb", "config/environments/production.rb"
m.file "environments/development.rb", "config/environments/development.rb"