提交 31eb7656 编写于 作者: A Aaron Patterson

refacoring duplicate code. <3 <3 <3

上级 50041e56
......@@ -2213,8 +2213,9 @@ def build_has_many(aliased_table, parent_table)
first_key = second_key = nil
if through_reflection.options[:as] # has_many :through against a polymorphic join
jt_foreign_key = through_reflection.options[:as].to_s + '_id'
jt_as_extra = join_table[through_reflection.options[:as].to_s + '_type'].eq(parent.active_record.base_class.name)
as_key = through_reflection.options[:as].to_s
jt_foreign_key = as_key + '_id'
jt_as_extra = join_table[as_key + '_type'].eq(parent.active_record.base_class.name)
else
jt_foreign_key = through_reflection.primary_key_name
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册