Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Try loading activerecord-<adaptername>-adapter gem before trying a pl…

…ain require so you can use custom gems for the bundled adapters. Also stops gems from requiring an adapter from an old Active Record gem.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit a30a1a9d5f06f404421d65393bcf9d73885789cb 1 parent f2d7e51
@jeremy jeremy authored
View
5 activerecord/CHANGELOG
@@ -1,3 +1,8 @@
+*SVN*
+
+* Try loading activerecord-<adaptername>-adapter gem before trying a plain require so you can use custom gems for the bundled adapters. Also stops gems from requiring an adapter from an old Active Record gem. [Jeremy Kemper, Derrick Spell]
+
+
*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.14.2 - 1.15.3]
* Add attr_readonly to specify columns that are skipped during a normal ActiveRecord #save operation. Closes #6896 [dcmanges]
View
11 activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
@@ -207,21 +207,16 @@ def self.establish_connection(spec = nil)
spec = spec.symbolize_keys
unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end
- tried_gem = false
begin
+ require 'rubygems'
+ gem "activerecord-#{spec[:adapter]}-adapter"
require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
rescue LoadError
- raise if tried_gem
-
begin
- require 'rubygems'
- gem "activerecord-#{spec[:adapter]}-adapter"
+ require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
rescue LoadError
raise "Please install the #{spec[:adapter]} adapter: `gem install activerecord-#{spec[:adapter]}-adapter` (#{$!})"
end
-
- tried_gem = true
- retry
end
adapter_method = "#{spec[:adapter]}_connection"
Please sign in to comment.
Something went wrong with that request. Please try again.