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, name, settings = {}) ⇒ Role
constructor
A new instance of Role.
Constructor Details
#initialize(connection, name, settings = {}) ⇒ Role
Returns a new instance of Role.
13 14 15 16 17 |
# File 'app/models/omen/role.rb', line 13 def initialize(connection, name, settings = {}) @connection = connection @name = name @settings = settings end |
Instance Method Details
#around ⇒ Object
Given up before anything of ours runs; a statement Postgres refused rolls it back instead.
21 22 23 24 |
# File 'app/models/omen/role.rb', line 21 def around enter yield.tap { @connection.execute 'SET LOCAL ROLE NONE' } end |