You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.
I want to be able to delete a nested resource when I get a nested attribute set to nil.
Currently have an API that lets you manage nested resources. The model update logic expects the client to set an explicit nil when it wants to remove one of these related resources.
For example I have an API that exposes the People in the system. Those people have an optional Address.
To delete the address from a person set the address parameter to nil.
Everything works fine with the nested address attributes set:
I want to be able to delete a nested resource when I get a nested attribute set to
nil
.Currently have an API that lets you manage nested resources. The model update logic expects the client to set an explicit
nil
when it wants to remove one of these related resources.For example I have an API that exposes the People in the system. Those people have an optional Address.
To delete the address from a person set the
address
parameter tonil
.Everything works fine with the nested address attributes set:
But if the nested attributes is set to nil, it gets dropped:
This feels like it might be inconsistent because when I permit the scalar
address
on that same params hash, it will retain thenil
key:Is this the desired behavior, or would it be preferred to retain the
nil
value?I havn't looked into implemntation, but would be happy to work in a PR if this is a desired behavior.
The text was updated successfully, but these errors were encountered: