Permalink
Browse files

Check for the dir instead of relying on an exception.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7768 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent cd64471 commit a76fa613d3b5c13ed592c85e64a26e70f0020ddc @jeremy jeremy committed Oct 7, 2007
Showing with 7 additions and 5 deletions.
  1. +7 −5 activerecord/lib/active_record.rb
View
12 activerecord/lib/active_record.rb
@@ -24,13 +24,15 @@
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-unless defined?(ActiveSupport)
- begin
- $:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib")
- require 'active_support'
- rescue LoadError
+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
end

0 comments on commit a76fa61

Please sign in to comment.