Skip to content

Instantly share code, notes, and snippets.

@tomharris
Created February 25, 2013 23:27
Show Gist options
  • Save tomharris/5034307 to your computer and use it in GitHub Desktop.
Save tomharris/5034307 to your computer and use it in GitHub Desktop.
The connection is not properly checked-out of the connection pool. AR may give it to other threads to use
module DataLoad
class Thing1
def reload_all
connection = ActiveRecord::Base.connection
sql = <<-SQL
create temporary table tmp_thing1 (
-- ...
)
SQL
connection.execute(sql)
sql = <<-SQL
-- Load data
SQL
connection.execute(sql)
sql = <<-SQL
-- Do things with the data
SQL
connection.execute(sql)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment