From 901fc6a016fb5475d9e8cf17dd604ba427c0f3cf Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 29 Mar 2011 17:47:26 +0200 Subject: [PATCH] ask the engine for our connection rather than ActiveRecord::Base --- lib/report/chainable.rb | 2 +- lib/report/query_utils.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/report/chainable.rb b/lib/report/chainable.rb index e5138225fe..fa2ddbf7d8 100644 --- a/lib/report/chainable.rb +++ b/lib/report/chainable.rb @@ -206,7 +206,7 @@ class Report < ActiveRecord::Base end def compute_result - engine::Result.new ActiveRecord::Base.connection.select_all(sql_statement.to_s), {}, type + engine::Result.new engine.connection.select_all(sql_statement.to_s), {}, type end def table_joins diff --git a/lib/report/query_utils.rb b/lib/report/query_utils.rb index 6423feb351..28fee8b8dc 100644 --- a/lib/report/query_utils.rb +++ b/lib/report/query_utils.rb @@ -1,7 +1,7 @@ module Report::QueryUtils alias singleton_class metaclass unless respond_to? :singleton_class - delegate :quoted_false, :quoted_true, :to => "ActiveRecord::Base.connection" + delegate :quoted_false, :quoted_true, :to => "engine.connection" attr_writer :engine module PropagationHook @@ -43,7 +43,7 @@ module Report::QueryUtils # @return [Object] Quoted version def quote_string(str) return str unless str.respond_to? :to_str - ActiveRecord::Base.connection.quote_string(str) + engine.connection.quote_string(str) end ## @@ -71,7 +71,7 @@ module Report::QueryUtils end def quoted_date(date) - ActiveRecord::Base.connection.quoted_date date.to_dateish + engine.connection.quoted_date date.to_dateish end ## @@ -172,7 +172,7 @@ module Report::QueryUtils end def adapter_name - ActiveRecord::Base.connection.adapter_name.downcase.to_sym + engine.connection.adapter_name.downcase.to_sym end def cache