Skip to content
This repository
Browse code

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...
commit cf28109158054fbab91de2d6d86efe1b40e68d93 1 parent b5c4c7d
Tarmo Tänav authored
18  activerecord/lib/active_record.rb
@@ -24,16 +24,14 @@
24 24
 $:.unshift(File.dirname(__FILE__)) unless
25 25
   $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
26 26
 
27  
-unless defined? ActiveSupport
28  
-  active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib"
29  
-  if File.exist?(active_support_path)
30  
-    $:.unshift active_support_path
31  
-    require 'active_support'
32  
-  else
33  
-    require 'rubygems'
34  
-    gem 'activesupport'
35  
-    require 'active_support'
36  
-  end
  27
+active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib"
  28
+if File.exist?(active_support_path)
  29
+  $:.unshift active_support_path
  30
+  require 'active_support'
  31
+else
  32
+  require 'rubygems'
  33
+  gem 'activesupport'
  34
+  require 'active_support'
37 35
 end
38 36
 
39 37
 require 'active_record/base'
1  railties/lib/initializer.rb
@@ -49,6 +49,7 @@ def root
49 49
     end
50 50
 
51 51
     def env
  52
+      require 'active_support/string_inquirer'
52 53
       ActiveSupport::StringInquirer.new(RAILS_ENV)
53 54
     end
54 55
 

0 notes on commit cf28109

Please sign in to comment.
Something went wrong with that request. Please try again.