`foreign_type` relationship failing on Rails 6

Viewed 784

I'm trying to understand this relationship setup on this model, and why is this an issue on Rails 6.

Coming from Rails 3, this relationship is defined as:

belongs_to :entity foreign_key: 'user_id', foreign_type: 'ruby_type'

This worked fine, all the way up to Rails 5 (At least our crawl and traceroute did not bring this as an issue).

However, once we got to Rails 6, we found the following:

ArgumentError: Unknown key: :foreign_type. Valid keys are: :class_name, :anonymous_class, :primary_key, :foreign_key, :dependent, :validate, :inverse_of, :strict_loading, :autosave, :required, :touch, :polymorphic, :counter_cache, :optional, :default

Was this syntax changed for Rails 6?

1 Answers
Related