Skip to content

Commit 66bc23f

Browse files
committed
Make sure ArResolver works for other adapter with proxy
1 parent cb446dc commit 66bc23f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
module FreshConnection
4+
module Extend
5+
module OtherAdapterProxy
6+
private
7+
8+
def __change_connection
9+
yield
10+
end
11+
end
12+
end
13+
end

lib/fresh_connection/extend/ar_resolver.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ def spec(*args)
1414
require 'fresh_connection/extend/adapters/pg_adapter'
1515
__extend_adapter_by_fc(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, PgAdapter)
1616
else
17-
raise NotImplementedError, "This adapter('#{specification.config[:adapter]}') is not supported. If you specified the mysql or postgres adapter, it's probably a bug in FreshConnection. Please teach me (https://github.com/tsukasaoishi/fresh_connection/issues/new)"
17+
require 'fresh_connection/extend/adapters/other_adapter_proxy'
18+
base_adapter_name = "#{specification.config[:adapter].to_s}_adapter".camelize
19+
__extend_adapter_by_fc(
20+
"::ActiveRecord::ConnectionAdapters::#{base_adapter_name}".constantize,
21+
OtherAdapterProxy
22+
)
1823
end
1924

2025
specification

0 commit comments

Comments
 (0)