Permalink
Browse files

remove dead code / make duplicate code more obvious

  • Loading branch information...
1 parent 085bb23 commit 32fcdb3b9e95669ca024285364f96b083135ee82 @tenderlove tenderlove committed Oct 11, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/associations/join_dependency.rb
@@ -53,7 +53,6 @@ def self.walk_tree(associations, hash)
#
def initialize(base, associations, joins)
@base_klass = base
- @table_joins = joins
@join_root = JoinBase.new(base)
@alias_tracker = AliasTracker.new(base.connection, joins)
@alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1
@@ -215,10 +214,11 @@ def construct(ar_parent, parent, row, rs)
end
def construct_association(record, parent, join_part, row, rs)
- caster = rs.column_type(parent.aliased_primary_key)
- row_id = caster.type_cast row[parent.aliased_primary_key]
+ primary_key = parent.aliased_primary_key
+ type_caster = rs.column_type primary_key
+ primary_id = type_caster.type_cast row[parent.aliased_primary_key]
- return if record.id != row_id
+ return if record.id != primary_id
macro = join_part.reflection.macro
if macro == :has_one

0 comments on commit 32fcdb3

Please sign in to comment.