Closed pavelsr closed 4 years ago
Merge request: #94
This was solved in a couple ways:
properties
stash now controls which fields get shown in a form_for
form (commit d1a7e8d)form_for
(commit 2b78e7b9)Thanks for reporting this and providing a patch!
Hey Doug! Seems like we should add skip_fields
arg in addition to properties
I found at least one use case where it could be extremelly usefull - skipping user_id
field in item add/edit form in multiTenant apps.
Code example:
# controller:
$user_route->get('/bank_details/edit/:id')->to( 'yancy-multi_tenant#get', schema => 'bank_details', template => 'bank_detail_edit' );
# bank_detail_edit.html.ep
%= $c->yancy->form->form_for( 'bank_details', skip_fields => [ 'id', 'user_id' ] );
For now I have to use long and not elegant construction:
properties => [ grep { $_ !~ /id/ } keys %{ $c->yancy->backend->schema->{bank_details}{properties} } ]
E.g. I have schema
If I call form_for there is no way to skip fields like id, created, is_admin which are typically not required for user input.