Permalink
Browse files

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.
  • Loading branch information...
1 parent 9e65cbd commit 69d9ec3909b2b29a0266a274fb5cef6b56befd73 @tarmo tarmo committed Aug 23, 2008
Showing with 9 additions and 10 deletions.
  1. +8 −10 activerecord/lib/active_record.rb
  2. +1 −0 railties/lib/initializer.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'
@@ -36,6 +36,7 @@ def root
end
def env
+ require 'active_support/string_inquirer'
ActiveSupport::StringInquirer.new(RAILS_ENV)
end

0 comments on commit 69d9ec3

Please sign in to comment.