aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-08-19 19:36:06 -0300
committerEmilio Tagua <miloops@gmail.com>2009-08-19 19:36:06 -0300
commita60334fdc5d4f612bd2dd70e38d1e57481cd5910 (patch)
treea3644d3db7bf0c2f8c7766ad7793e5a2a74ee010
parent54fcbb881d1d707d65d38cd30f50049023448832 (diff)
downloadrails-a60334fdc5d4f612bd2dd70e38d1e57481cd5910.tar.gz
rails-a60334fdc5d4f612bd2dd70e38d1e57481cd5910.tar.bz2
rails-a60334fdc5d4f612bd2dd70e38d1e57481cd5910.zip
Remove useless conditionals/local var.
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 068943c454..b363cceccb 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -2089,8 +2089,6 @@ module ActiveRecord
]
when :has_many, :has_one
if reflection.options[:through]
- through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : ''
-
jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil
first_key = second_key = as_extra = nil
@@ -2154,7 +2152,7 @@ module ActiveRecord
as_extra]
]
- elsif reflection.options[:as] && [:has_many, :has_one].include?(reflection.macro)
+ elsif reflection.options[:as]
"%s.%s = %s.%s AND %s.%s = %s" % [
connection.quote_table_name(aliased_table_name),
"#{reflection.options[:as]}_id",
@@ -2180,8 +2178,6 @@ module ActiveRecord
connection.quote_table_name(parent.aliased_table_name),
options[:foreign_key] || reflection.primary_key_name
]
- else
- ""
end
@join << %(AND %s) % [
klass.send(:type_condition, aliased_table_name)] unless klass.descends_from_active_record?