Skip to content

association pluralization? #224

Open
@adamkittelson

Description

@adamkittelson

I have a has_many, through: association called :items_for_sale in my application. When I try to update an item I get an error which I've tracked down to these lines in ex_admin:

{assoc_model, join_model} = get_assoc_model resource, assoc
assoc_instance = assoc_model.__struct__

def do_collection(resource, {assoc, ids}) do
    {assoc_model, join_model} = get_assoc_model resource, assoc
    assoc_instance = assoc_model.__struct__

for some reason my association appears to have been programmatically pluralized because at this point assoc no longer reads :items_for_sale, but rather :items_for_sales, since there is no such association get_assoc_model returns an :error tuple, :error is bound to assoc_model, and an exception is raised on the next line when it attempts to call :error.__struct__

I've worked around this by going with the flow and just calling my association :items_for_sales for now.

Thanks for looking into this and thanks for all your work on ex_admin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions