aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2008-06-04 13:58:58 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-25 19:04:09 -0700
commit0b12da44aa35b643b17ab1b61634ff952993e357 (patch)
tree6774141167461cc920922b532274866726eb67aa /activerecord/lib/active_record/associations/has_many_through_association.rb
parenta93ea88c0623b4f65af98c0eb55924c335bb3ac1 (diff)
downloadrails-0b12da44aa35b643b17ab1b61634ff952993e357.tar.gz
rails-0b12da44aa35b643b17ab1b61634ff952993e357.tar.bz2
rails-0b12da44aa35b643b17ab1b61634ff952993e357.zip
Extract owner_quoted_id so it can be overridden. [#292 state:committed]
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb6
1 files changed, 3 insertions, 3 deletions
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 52ced36d16..e1bfff5923 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -107,12 +107,12 @@ module ActiveRecord
# Associate attributes pointing to owner, quoted.
def construct_quoted_owner_attributes(reflection)
if as = reflection.options[:as]
- { "#{as}_id" => @owner.quoted_id,
+ { "#{as}_id" => owner_quoted_id,
"#{as}_type" => reflection.klass.quote_value(
@owner.class.base_class.name.to_s,
reflection.klass.columns_hash["#{as}_type"]) }
else
- { reflection.primary_key_name => @owner.quoted_id }
+ { reflection.primary_key_name => owner_quoted_id }
end
end
@@ -183,7 +183,7 @@ module ActiveRecord
when @reflection.options[:finder_sql]
@finder_sql = interpolate_sql(@reflection.options[:finder_sql])
- @finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.primary_key_name} = #{@owner.quoted_id}"
+ @finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.primary_key_name} = #{owner_quoted_id}"
@finder_sql << " AND (#{conditions})" if conditions
else
@finder_sql = construct_conditions