ask the engine for our connection rather than ActiveRecord::Base

pull/6827/head
Konstantin Haase 14 years ago
parent b147fd417d
commit b007d40897
  1. 2
      lib/report/chainable.rb
  2. 8
      lib/report/query_utils.rb

@ -206,7 +206,7 @@ class Report < ActiveRecord::Base
end end
def compute_result 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 end
def table_joins def table_joins

@ -1,7 +1,7 @@
module Report::QueryUtils module Report::QueryUtils
alias singleton_class metaclass unless respond_to? :singleton_class 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 attr_writer :engine
module PropagationHook module PropagationHook
@ -43,7 +43,7 @@ module Report::QueryUtils
# @return [Object] Quoted version # @return [Object] Quoted version
def quote_string(str) def quote_string(str)
return str unless str.respond_to? :to_str return str unless str.respond_to? :to_str
ActiveRecord::Base.connection.quote_string(str) engine.connection.quote_string(str)
end end
def current_language def current_language
@ -75,7 +75,7 @@ module Report::QueryUtils
end end
def quoted_date(date) def quoted_date(date)
ActiveRecord::Base.connection.quoted_date date.to_dateish engine.connection.quoted_date date.to_dateish
end end
## ##
@ -175,7 +175,7 @@ module Report::QueryUtils
end end
def adapter_name def adapter_name
ActiveRecord::Base.connection.adapter_name.downcase.to_sym engine.connection.adapter_name.downcase.to_sym
end end
def cache def cache

Loading…
Cancel
Save