If you run an olap query with a :joins, the 'id' column will be considered ambiguous. You need to prepend the table name to the front of the column for each dimension. In dimension.rb, line 58, add the @klass.connection.send(:quote_table_name, @klass.table_name) + '.' + to the beginning of the column name:
def to_case_expression(variable_name)
if @category_field
@klass.connection.send(:quote_table_name, @klass.table_name) + '.' +
"#{@klass.connection.send(:quote_column_name, @category_field)} AS #{@klass.connection.send(:quote_column_name, variable_name)}"
else
whens = @categories.map { |category| @klass.send(:sanitize_sql, ["WHEN (#{category.to_sanitized_sql}) THEN ?", category.label.to_s]) }
"CASE #{whens.join(' ')} ELSE NULL END AS #{@klass.connection.send(:quote_column_name, variable_name)}";
end
end
You'll probably want to implement a more robust solution though.
If you run an olap query with a :joins, the 'id' column will be considered ambiguous. You need to prepend the table name to the front of the column for each dimension. In dimension.rb, line 58, add the @klass.connection.send(:quote_table_name, @klass.table_name) + '.' + to the beginning of the column name:
You'll probably want to implement a more robust solution though.