1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

RubyGem database adapters: expects a gem named activerecord-<database>-adapter with active_record/connection_adapters/<database>_adapter.rb in its load path.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7491 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-09-15 23:21:21 +00:00
parent c30c1808c0
commit f92503c541
2 changed files with 21 additions and 3 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* RubyGem database adapters: expects a gem named activerecord-<database>-adapter with active_record/connection_adapters/<database>_adapter.rb in its load path. [Jeremy Kemper]
* Added block-acceptance to JavaScriptHelper#javascript_tag #7527 [BobSilva/tarmo/rmm5t]
* Fixed that altering join tables in migrations would fail w/ sqlite3 #7453 [TimoMihaljov/brandon]

View file

@ -206,10 +206,26 @@ module ActiveRecord
else
spec = spec.symbolize_keys
unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end
adapter_method = "#{spec[:adapter]}_connection"
require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
unless respond_to?(adapter_method)
tried_gem = false
begin
require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
rescue LoadError
raise if tried_gem
begin
require 'rubygems'
gem "activerecord-#{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"
if !respond_to?(adapter_method)
raise AdapterNotFound, "database configuration specifies nonexistent #{spec[:adapter]} adapter"
end