Class: ThreadUtility

Inherits:
Object show all
Defined in:
lib/dominate/widget/event.rb

Overview

Class Method Summary collapse

Class Method Details

.with_connection(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dominate/widget/event.rb', line 5

def self.with_connection(&block)
  begin
    yield block
  rescue Exception => e
    raise e
  ensure
    # Check the connection back in to the connection pool
    if defined? ActiveRecord
      ActiveRecord::Base.connection.close if ActiveRecord::Base.connection
    end
  end
end