~cytrogen/masto-fe

ref: 68b4e36c82344fba7c5a01e9f8dc9ddbaaf4e3ff masto-fe/app/helpers/database_helper.rb -rw-r--r-- 269 bytes
68b4e36c — Eugen Rochko Fix `#hashtag` matching non-hashtagged posts in search (#26781) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

module DatabaseHelper
  def with_read_replica(&block)
    ApplicationRecord.connected_to(role: :reading, prevent_writes: true, &block)
  end

  def with_primary(&block)
    ApplicationRecord.connected_to(role: :writing, &block)
  end
end