Skip to content

Commit

Permalink
Include bundled env in toplevel require, if present
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Oct 15, 2009
1 parent df55781 commit 9c52f96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 10 additions & 8 deletions activerecord/lib/active_record.rb
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions 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'
Expand Down

0 comments on commit 9c52f96

Please sign in to comment.