instance method
preventing_writes?
Ruby on Rails 6.1.7.10
Since v6.0.6Signature
preventing_writes?()
Determines whether writes are currently being prevented.
Returns true if the connection is a replica.
If the application is using legacy handling, returns true if connection_handler.prevent_writes is set.
If the application is using the new connection handling will return true based on current_preventing_writes.
Source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 122
def preventing_writes?
return true if replica?
return ActiveRecord::Base.connection_handler.prevent_writes if ActiveRecord::Base.legacy_connection_handling
return false if connection_klass.nil?
connection_klass.current_preventing_writes
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 122
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter