From 030480ac1f4fbf8bf74a0d9298544426caf26894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81omnicki?= Date: Sun, 12 Dec 2010 01:37:56 +0100 Subject: Fix behaviour of foo.has_many_through_association.select('custom select') [#6089 state:resolved] --- .../lib/active_record/associations/through_association_scope.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb index 99920d4c63..c11fce5db0 100644 --- a/activerecord/lib/active_record/associations/through_association_scope.rb +++ b/activerecord/lib/active_record/associations/through_association_scope.rb @@ -63,8 +63,8 @@ module ActiveRecord end def construct_select(custom_select = nil) - distinct = "DISTINCT " if @reflection.options[:uniq] - custom_select || @reflection.options[:select] || "#{distinct}#{@reflection.quoted_table_name}.*" + distinct = "DISTINCT #{@reflection.quoted_table_name}.*" if @reflection.options[:uniq] + custom_select || @reflection.options[:select] || distinct end def construct_joins -- cgit v1.2.3