mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't generate foreign_type
if options[:polymorphic]
is not given
Because the reflection doesn't have `foreign_type` unless the association is a polymorphic association.
This commit is contained in:
parent
aa1cf119a6
commit
8d3bf8b66c
1 changed files with 1 additions and 1 deletions
|
@ -426,7 +426,7 @@ module ActiveRecord
|
|||
def initialize(name, scope, options, active_record)
|
||||
super
|
||||
@type = options[:as] && (options[:foreign_type] || "#{options[:as]}_type")
|
||||
@foreign_type = options[:foreign_type] || "#{name}_type"
|
||||
@foreign_type = options[:polymorphic] && (options[:foreign_type] || "#{name}_type")
|
||||
@constructable = calculate_constructable(macro, options)
|
||||
@association_scope_cache = Concurrent::Map.new
|
||||
|
||||
|
|
Loading…
Reference in a new issue