aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-28 04:33:44 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-08-28 04:33:44 +0900
commitf0811db8074e46feef368161f8b12e592bb4c559 (patch)
treef3231ce41db24dc81dbe06dc8783c440a46f26a4 /activerecord/lib
parent4d7436f0aa571794b62be12b90b10e7b1646df90 (diff)
downloadrails-f0811db8074e46feef368161f8b12e592bb4c559.tar.gz
rails-f0811db8074e46feef368161f8b12e592bb4c559.tar.bz2
rails-f0811db8074e46feef368161f8b12e592bb4c559.zip
`@previous_reflection.options[:source_type]` in `PolymorphicReflection` is always true
Because `add_as_polymorphic_through` is only called when `options[:source_type]` is true.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/reflection.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 97a98235d9..00ff20f4d7 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -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