Skip to content

Commit 4ea0433

Browse files
authored
Merge pull request rails#44854 from seejohnrun/simplify-connected-to-check
Use connection_class to check in connected_to
2 parents 39b7bf7 + 3e93613 commit 4ea0433

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/connection_handling.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def connected_to(role: nil, shard: nil, prevent_writes: false, &blk)
139139
raise NotImplementedError, "calling `connected_to` is only allowed on ActiveRecord::Base or abstract classes."
140140
end
141141

142-
if name != connection_specification_name && !primary_class?
142+
if !connection_class? && !primary_class?
143143
raise NotImplementedError, "calling `connected_to` is only allowed on the abstract class that established the connection."
144144
end
145145

0 commit comments

Comments
 (0)