Defining different attributes for new
/create
or edit
/update
actions without defining FORM_ATTRIBUTES
makes it crash
#2066
Labels
bug
breakages in functionality that is implemented
What were you trying to do?
Upgraded from
0.13
tomain
(9e462f7). I tried to define different attributes for new/create or edit/update actions as stated here: https://github.com/thoughtbot/administrate/blob/main/docs/customizing_dashboards.md#form-attributesWhen trying to
update
orcreate
a record in the dashboard, there is a crash. This is because, when validating permitted attributes, it's trying to get these attributes fromself.class::FORM_ATTRIBUTES
but it should get them from"FORM_ATTRIBUTES_#{action.upcase}"
asFORM_ATTRIBUTES
is not defined anymore.specific_form_attributes_for(action)
is returningnil
becauseaction
is not being passed inpermitted_attributes
. So the solution is to pass theaction_name
when checking permitted attributes.What did you end up with (logs, or, even better, example apps are great!)?
The affected code is related with Allow different form attributes for new/update actions #1991
Logs:
My workaround:
In my
UserDashboard
added the following overrides:In my
Admin::UsersController
add the following override:What versions are you running?
The text was updated successfully, but these errors were encountered: