https://avo.cool logo
Hi, This is not a complaint or concern, merely ...
# resources
p
Hi, This is not a complaint or concern, merely a question: I have models of Attraction, Company, Companyable. The associations are: Attraction:
Copy code
has_many :companyables, as: :companyable
    has_many :companies, -> { distinct }, through: :companyables
Company:
Copy code
has_many :companyables
    has_many :attractions, through: :companyables, source: :companyable, source_type: 'Attraction'
    has_many :roles, -> { distinct }, through: :companyables
Companyable:
Copy code
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:
Copy code
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.
m
Thread automatically created by rctneil in #1141725701549072486
l
Hi @purple-park-97233 If the term "Companyable" isn’t immediately intelligible, renaming it to simply "Company" could enhance the user experience.
p
But Company is the other side of the through model, therefore is already taken. The Companyable joins the Attraction to the Company. The join model needs to be used as that’s where the role attribute is stored
l
Got it. Have you considered any alternative names?
p
Well Companyable is fine technically. It’s more a UI issue for potential users. The tech part works perfectly. I just think the UI saying Companyable is confusing. I understand it as I know how a has_many through works and the reason it’s there, but other users won’t understand that.