1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

@previous_reflection.options[:source_type] in PolymorphicReflection is always true

Because `add_as_polymorphic_through` is only called when
`options[:source_type]` is true.
This commit is contained in:
Ryuta Kamizono 2017-08-28 04:33:44 +09:00
parent 4d7436f0aa
commit f0811db807

View file

@ -1036,20 +1036,12 @@ module ActiveRecord
def scopes
scopes = @previous_reflection.scopes
if @previous_reflection.options[:source_type]
scopes + [@previous_reflection.source_type_scope]
else
scopes
end
scopes << @previous_reflection.source_type_scope
end
def join_scopes(table, predicate_builder) # :nodoc:
scopes = @previous_reflection.join_scopes(table, predicate_builder) + super
if @previous_reflection.options[:source_type]
scopes + [@previous_reflection.source_type_scope]
else
scopes
end
scopes << @previous_reflection.source_type_scope
end
def klass