Skip to content

Commit

Permalink
Always require activesupport, even if its constant already exists
Browse files Browse the repository at this point in the history
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
tarmo committed Aug 23, 2008
1 parent b5c4c7d commit cf28109
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 8 additions & 10 deletions activerecord/lib/active_record.rb
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions railties/lib/initializer.rb
Expand Up @@ -49,6 +49,7 @@ def root
end

def env
require 'active_support/string_inquirer'
ActiveSupport::StringInquirer.new(RAILS_ENV)
end

Expand Down

0 comments on commit cf28109

Please sign in to comment.