Class: Omen::Role
- Inherits:
-
Object
- Object
- Omen::Role
- Defined in:
- app/models/omen/role.rb
Overview
The Postgres role a reading's statement runs as, which is refused the reading's own tables.
Defined Under Namespace
Classes: Unavailable
Constant Summary collapse
- MISCONFIGURED =
Ours to write, since it quotes no row: what an asker is told when it was the setup that failed.
'This app is misconfigured, not the question -- ask an engineer to install ' \ 'the read-only role a statement runs as.'
Instance Method Summary collapse
-
#around ⇒ Object
Given up before anything of ours runs; a statement Postgres refused rolls it back instead.
-
#initialize(connection) ⇒ Role
constructor
A new instance of Role.
Constructor Details
#initialize(connection) ⇒ Role
Returns a new instance of Role.
11 12 13 |
# File 'app/models/omen/role.rb', line 11 def initialize(connection) @connection = connection end |
Instance Method Details
#around ⇒ Object
Given up before anything of ours runs; a statement Postgres refused rolls it back instead.
17 18 19 20 |
# File 'app/models/omen/role.rb', line 17 def around enter yield.tap { @connection.execute 'SET LOCAL ROLE NONE' } end |