Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord/tablelocks/activerecord/postgres.rb

Instance Method Summary collapse

Instance Method Details

#lock_table(quoted_table_name) ⇒ Object



4
5
6
# File 'lib/activerecord/tablelocks/activerecord/postgres.rb', line 4

def lock_table(quoted_table_name)
  execute "LOCK TABLE #{quoted_table_name} IN EXCLUSIVE MODE"
end

#lock_tables(quoted_table_names) ⇒ Object



7
8
9
10
11
# File 'lib/activerecord/tablelocks/activerecord/postgres.rb', line 7

def lock_tables(quoted_table_names)
  quoted_table_names.each do |quoted_table_name|
    lock_table quoted_table_name
  end
end