class ThreadUtility

t-a-w.blogspot.com/2010/05/very-simple-parallelization-with-ruby.html

Public Class Methods

with_connection() { |block| ... } click to toggle source
# 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