Class: Fatalistic::PostgresLocker

Inherits:
Locker
  • Object
show all
Defined in:
lib/fatalistic.rb

Overview

Table locking for Postgres.

Instance Attribute Summary

Attributes inherited from Locker

#model_class

Instance Method Summary collapse

Methods inherited from Locker

for, #initialize, #unlock

Constructor Details

This class inherits a constructor from Fatalistic::Locker

Instance Method Details

#lock(lock_statement = nil) ⇒ Object



46
47
48
49
50
# File 'lib/fatalistic.rb', line 46

def lock(lock_statement = nil)
  stmt = "LOCK TABLE #{quoted_table_name}"
  stmt.insert(-1, " #{lock_statement}") if lock_statement
  connection.execute(stmt)
end