Fields displayed on collections using the polymorphic associations
Observed behavior
When using the old major version (8.3.1), polymorphic fields were correctly displayed (field_type, field_id), since we upgraded to v9 (9.3.16) the fields just disappeared and there’s no way to show them (unless using smart fields)
Expected behavior
Display the polymorphic fields (field_id, field_type)
Failure Logs
The polymorphic fields disappeared from the forest schema. I see them back when reverting to v8
Context
Project name: Trustpair
Team name: Product
Environment name: Production
Agent technology: rails
Agent (forest package) name & version: 9.3.16
Database type: postgres
Recent changes made on your end if any: upgraded from v8 to v9
Hey Jeff,
Thanks for the quick reply. Yes we noticed that those fields aren’t present anymore, but it would still be interesting to see the type, as we believe it provides valuable information to the user.
In our case, we have a company registration polymorphic association, and it would be insightful to know which type of registration it is without actually having to check the DB or even adding the smart field.
The schema is properly reflecting the polymorphic relationships, so it’s working as you expect.
Also, something worth mentioning is that, in case the model class name and the relationship name changes, the type is still displayed in the UI (what we want).
# The registration type is not shown in the collection
class CompanyRegistration < ApplicationRecord
# registration_type :string
belongs_to :registration, inverse_of: :company_registration, polymorphic: true
# ...
end
# The type IS shown in the collection
class Notification < ApplicationRecord
# recipient_type :string not null
belongs_to :recipient, polymorphic: true