From cf28109158054fbab91de2d6d86efe1b40e68d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarmo=20T=C3=A4nav?= Date: Sat, 23 Aug 2008 18:05:52 +0300 Subject: Always require activesupport, even if its constant already exists This is needed because the existance of the ActiveSupport constant by itself does not guarantee that the whole library has been loaded. Also load the StringInquirer in the Rails#env method as the it might be called inside the initializer block before activesupport itself has been loaded. --- activerecord/lib/active_record.rb | 18 ++++++++---------- railties/lib/initializer.rb | 1 + 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index bc27d17ccd..7612015ca5 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -24,16 +24,14 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) -unless defined? ActiveSupport - active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib" - if File.exist?(active_support_path) - $:.unshift active_support_path - require 'active_support' - else - require 'rubygems' - gem 'activesupport' - require 'active_support' - end +active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib" +if File.exist?(active_support_path) + $:.unshift active_support_path + require 'active_support' +else + require 'rubygems' + gem 'activesupport' + require 'active_support' end require 'active_record/base' diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index ee847e5561..008f1de8fa 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -49,6 +49,7 @@ module Rails end def env + require 'active_support/string_inquirer' ActiveSupport::StringInquirer.new(RAILS_ENV) end -- cgit v1.2.3