date_column to_sql now includes table_name to avoid ambiguous column names when using the :include option - reportable - Fork of reportable required by WarVox, from hdm/reportable.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 498c6adcdb7b2261580d7d32d6b991702fe09804
(DIR) parent ad7246944c072bd3fe1632a62eecacb4be1abbe0
(HTM) Author: Pedro Freitas <pelf@webreakstuff.com>
Date: Tue, 19 Mar 2013 14:39:45 +0000
date_column to_sql now includes table_name to avoid ambiguous column names when using the :include option
Diffstat:
M lib/saulabs/reportable/report.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/lib/saulabs/reportable/report.rb b/lib/saulabs/reportable/report.rb
@@ -122,8 +122,8 @@ module Saulabs
:conditions => conditions,
:include => options[:include],
:distinct => options[:distinct],
- :group => options[:grouping].to_sql(@date_column),
- :order => "#{options[:grouping].to_sql(@date_column)} ASC",
+ :group => options[:grouping].to_sql("#{ActiveRecord::Base.connection.quote_table_name(@klass.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(@date_column.to_s)}"),
+ :order => "#{options[:grouping].to_sql("#{ActiveRecord::Base.connection.quote_table_name(@klass.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(@date_column.to_s)}")} ASC",
:limit => options[:limit]
)
end