database_helper.rb 269 B

1234567891011
  1. # frozen_string_literal: true
  2. module DatabaseHelper
  3. def with_read_replica(&block)
  4. ApplicationRecord.connected_to(role: :reading, prevent_writes: true, &block)
  5. end
  6. def with_primary(&block)
  7. ApplicationRecord.connected_to(role: :writing, &block)
  8. end
  9. end