Skip to content

Commit

Permalink
Merge pull request #44854 from seejohnrun/simplify-connected-to-check
Browse files Browse the repository at this point in the history
Use connection_class to check in connected_to
  • Loading branch information
eileencodes committed Apr 7, 2022
2 parents 39b7bf7 + 3e93613 commit 4ea0433
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/connection_handling.rb
Expand Up @@ -139,7 +139,7 @@ def connected_to(role: nil, shard: nil, prevent_writes: false, &blk)
raise NotImplementedError, "calling `connected_to` is only allowed on ActiveRecord::Base or abstract classes."
end

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

Expand Down

0 comments on commit 4ea0433

Please sign in to comment.