10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/grouped_scope/has_many_association.rb', line 10
def construct_sql_with_group_scope
if @reflection.options[:grouped_scope]
table_name = @reflection.respond_to?(:quoted_table_name) ? @reflection.quoted_table_name : @reflection.klass.table_name
if @reflection.options[:as]
else
@finder_sql = "#{table_name}.#{@reflection.primary_key_name} IN (#{@owner.group.quoted_ids})"
@finder_sql << " AND (#{conditions})" if conditions
end
@counter_sql = @finder_sql
else
construct_sql_without_group_scope
end
end
|