Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/generators/voluntary/install/templates/features/support/database_cleaner_patches.rb,
lib/generators/voluntary/product_dummy/templates/features/support/database_cleaner_patches.rb

Instance Method Summary collapse

Instance Method Details

#disable_referential_integrity(&block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/voluntary/install/templates/features/support/database_cleaner_patches.rb', line 11

def disable_referential_integrity(&block)
   transaction {
     begin
       execute "SET CONSTRAINTS ALL DEFERRED"
       yield
     ensure
       execute "SET CONSTRAINTS ALL IMMEDIATE"
     end
   }
end