提交 d92a0d04 编写于 作者: S Sean Griffin

Merge pull request #25179 from kamipo/reuse_result_of_associated_table

Reuse a result of `table.associated_table(column)` in `AssociationQueryHandler.value_for`
......@@ -2,13 +2,14 @@ module ActiveRecord
class PredicateBuilder
class AssociationQueryHandler # :nodoc:
def self.value_for(table, column, value)
klass = if table.associated_table(column).polymorphic_association? && ::Array === value && value.first.is_a?(Base)
associated_table = table.associated_table(column)
klass = if associated_table.polymorphic_association? && ::Array === value && value.first.is_a?(Base)
PolymorphicArrayValue
else
AssociationQueryValue
end
klass.new(table.associated_table(column), value)
klass.new(associated_table, value)
end
def initialize(predicate_builder)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册