instance method
connected_to?
Ruby on Rails 6.0.6
Since v6.0.6Signature
connected_to?(role:)
Returns true if role is the current connected role.
ActiveRecord::Base.connected_to(role: :writing) do ActiveRecord::Base.connected_to?(role: :writing) #=> true ActiveRecord::Base.connected_to?(role: :reading) #=> false end
Parameters
-
rolekeyreq
Source
# File activerecord/lib/active_record/connection_handling.rb, line 135
def connected_to?(role:)
current_role == role.to_sym
end
Defined in activerecord/lib/active_record/connection_handling.rb line 135
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionHandling