ex_admin
ex_admin copied to clipboard
association pluralization?
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:
https://github.com/smpallen99/ex_admin/blob/310b00c89a9f7719cdaf9796aee39b6904fd42b4/lib/ex_admin/repo.ex#L176-L177
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!
I want to overhaul the repo/changeset design of ex_admin to better use the features of Ecto2 and support the new data types. I'll address this issue then. Thanks for submitting the issue.
Any progress on this? @smpallen99 It pluralizes categories to categorys. :/
What is a quick work around?