From 8c3b8323f57d366fc308e773b286a1847552b0a3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 16:36:05 -0300 Subject: Use ARel in SQL generation through associations --- .../active_record/associations/has_many_through_association.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb') diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index e8dbae9011..51fb75e1f5 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -32,7 +32,7 @@ module ActiveRecord return @target.size if loaded? return count end - + protected def target_reflection_has_associated_record? if @reflection.through_reflection.macro == :belongs_to && @owner[@reflection.through_reflection.primary_key_name].blank? @@ -48,7 +48,7 @@ module ActiveRecord options[:joins] = construct_joins(options[:joins]) options[:include] = @reflection.source_reflection.options[:include] if options[:include].nil? end - + def insert_record(record, force = true, validate = true) if record.new_record? if force @@ -131,7 +131,7 @@ module ActiveRecord end def construct_from - @reflection.quoted_table_name + @reflection.table_name end def construct_select(custom_select = nil) @@ -239,7 +239,7 @@ module ActiveRecord interpolate_sql(sanitize_sql(conditions)) end end - + def build_sti_condition @reflection.through_reflection.klass.send(:type_condition) end -- cgit v1.2.3