Permalink
Browse files

Remove useless conditionals/local var.

  • Loading branch information...
1 parent 54fcbb8 commit a60334fdc5d4f612bd2dd70e38d1e57481cd5910 @miloops miloops committed Aug 19, 2009
Showing with 1 addition and 5 deletions.
  1. +1 −5 activerecord/lib/active_record/associations.rb
@@ -2089,8 +2089,6 @@ def association_join
]
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 @@ def association_join
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 @@ def association_join
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?

0 comments on commit a60334f

Please sign in to comment.