From 9c52f96acb1dad178ebde2205a8dda2dac3b3450 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 14 Oct 2009 19:15:33 -0700 Subject: [PATCH] Include bundled env in toplevel require, if present --- activerecord/lib/active_record.rb | 18 ++++++++++-------- activerecord/test/cases/helper.rb | 3 --- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index f4303f3f04315..2f9f1f120ce7e 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -21,17 +21,19 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" -$:.unshift(activesupport_path) if File.directory?(activesupport_path) -require 'active_support' +bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment" +if File.exist?("#{bundled}.rb") + require bundled +else + activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" + $:.unshift(activesupport_path) if File.directory?(activesupport_path) -begin - require 'active_model' -rescue LoadError - $:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib" - require 'active_model' + activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib" + $:.unshift(activemodel_path) if File.directory?(activemodel_path) end +require 'active_support' +require 'active_model' require 'arel' module ActiveRecord diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 67591640da668..aa09c7061fa0c 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,9 +1,6 @@ $:.unshift(File.dirname(__FILE__) + '/../../lib') $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib') -bundler = "#{File.dirname(__FILE__)}/../../vendor/gems/environment" -require bundler if File.exist?("#{bundler}.rb") - require 'config' require 'rubygems'