Feature(s) impacted
Some polymorphic fields not displayed correctly.
Observed behavior
Most of the polymorphic fields in our db are now displayed correctly using Polymorphic BelongsTo Typeahead, but some are not.
When trying to edit them that option does note exist.
class Example < ApplicationRecord
belongs_to :mapped_to, polymorphic: true, optional: true
belongs_to :something, optional: true
belongs_to :owner, class_name: 'Something'
end
def Something < Application Record
has_many :examples, inverse_of: :owner, foreign_key: :owner_id, dependent: :destroy
# no reference to the actual polymorphic field - maybe that's the issue?
end
{
"field": "mapped_to",
"type": "Number",
"default_value": null,
"enums": null,
"integration": null,
"is_filterable": false,
"is_read_only": false,
"is_required": false,
"is_sortable": true,
"is_virtual": false,
"reference": "mapped_to.id",
"inverse_of": "tpa_mapping",
"relationship": "BelongsTo",
"widget": null,
"validations": [],
"polymorphic_referenced_models": []
}
Is there a way to force them to be polymorphic in the UI?
Also side question: How does forest determine the polymorphic type options related to a specific field? Is there a way to manually control this?
Expected behavior
Being able to set the field as polymorphic
Context
Recently upgraded forest_liana from 8.0.13 to 9.1.0
Database: postgres (PostgreSQL) 16.2
Rails 7.0.8
Ruby 3.2.3
- Project name: Hint Health
- Team name: Hint Health
- Environment name: Production

