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:
parent
c30c1808c0
commit
f92503c541
2 changed files with 21 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*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]
|
* 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]
|
* Fixed that altering join tables in migrations would fail w/ sqlite3 #7453 [TimoMihaljov/brandon]
|
||||||
|
|
|
@ -206,10 +206,26 @@ module ActiveRecord
|
||||||
else
|
else
|
||||||
spec = spec.symbolize_keys
|
spec = spec.symbolize_keys
|
||||||
unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end
|
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"
|
tried_gem = false
|
||||||
unless respond_to?(adapter_method)
|
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"
|
raise AdapterNotFound, "database configuration specifies nonexistent #{spec[:adapter]} adapter"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue