Replace Makara with an initial Rails 6 role based splitting method.
This commit is contained in:
committed by
admin
parent
31922ea58b
commit
473c48b2aa
10
app/lib/force_db_writer_role.rb
Normal file
10
app/lib/force_db_writer_role.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module ForceDbWriterRole
|
||||
extend ActiveSupport::Concern
|
||||
# This is intended to be used as an around_action hook for GET
|
||||
# endpoints that need to perform writes to ActiveRecord
|
||||
def force_writer_db_role
|
||||
ActiveRecord::Base.connected_to(role: :writing) do
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user