lib/ensembl/variation/activerecord.rb in ensembl-0.0.10 vs lib/ensembl/variation/activerecord.rb in ensembl-0.0.11
- old
+ new
@@ -3,17 +3,26 @@
module Ensembl
module Variation
# ConnectionPool implemented from:
# http://www.lucasallan.com/2014/05/26/fixing-concurrency-issues-with-active-record-in-a-rack-application.html
- class Connection < ConnectionPooledBase
+ class Connection < ActiveRecord::Base
self.extend Ensembl::TableNameOverrides
self.abstract_class = true
self.establish_connection :variation
+ # ConnectionPool implemented from:
+ # http://www.lucasallan.com/2014/05/26/fixing-concurrency-issues-with-active-record-in-a-rack-application.html
+ singleton_class.send(:alias_method, :original_connection, :connection)
+
+ def self.connection
+ ActiveRecord::Base.connection_pool.with_connection do |conn|
+ conn
+ end
+ end
end
class ModelBase < Connection
self.extend PrimaryKeyOverrides
\ No newline at end of file