lib/vines/storage/sql.rb in vines-0.4.3 vs lib/vines/storage/sql.rb in vines-0.4.4

- old
+ new

@@ -21,14 +21,13 @@ # return connections to the pool when we're finished with them. This also # defers the original method by pushing it onto the EM thread pool because # ActiveRecord uses blocking IO. def self.with_connection(method, args={}) deferrable = args.key?(:defer) ? args[:defer] : true - old = "_with_connection_#{method}" - alias_method old, method + old = instance_method(method) define_method method do |*args| ActiveRecord::Base.connection_pool.with_connection do - method(old).call(*args) + old.bind(self).call(*args) end end defer(method) if deferrable end