purple-park-97233
03/23/2025, 1:37 PMhas_many :companyables, as: :companyable
has_many :companies, -> { distinct }, through: :companyables
Company:
has_many :companyables
has_many :attractions, through: :companyables, source: :companyable, source_type: 'Attraction'
has_many :roles, -> { distinct }, through: :companyables
Companyable:
belongs_to :company
belongs_to :companyable, polymorphic: true
belongs_to :role, optional: true
belongs_to :model, optional: true
belongs_to :submodel, optional: true
This works fine and on my Attraction resource I have:
tab "Companies" do
field :companyables, as: :has_many
end
This works fine and allows me to add new companyables via the UI where I can select the Role, the Model, and the SubModel for it. This all makes sense to me, but looking at it from a User perspective, they have no idea what a "Companyable" is, it's a made up word that means absolutely nothing to them.
To them they "want to add a Company to an Attraction", but technically what they need to do is "Add a Companyable to an Attraction" as the Companyable holds all the info about the role and the model/submodel.
Do I leave everything as it is and try to explain to Users what it means or can you recommend changes that may make it more user friendly and user understandable?
Changes could be as simple as altering wording. Could I change "Companyable" to "Company" just in the context of the UI? If I did that then the sidebar item for "Companyables" would be confusing.
It's tricky. Technically it all works beautifully and i'm very happy with it. Right now I ahve no plans to roll this out to other people so it is a non issue but it is something i've been thinking of how I could overcome it if I was to roll it out to others in the future.miniature-optician-85831
03/23/2025, 1:37 PMloud-jewelry-99127
03/25/2025, 8:37 AMpurple-park-97233
03/25/2025, 8:58 AMloud-jewelry-99127
03/25/2025, 9:44 AMpurple-park-97233
03/25/2025, 4:34 PM