1 year ago

Restful Child Resources

Posted 1 year ago by RexT

I'm making my app more restful and trying to go full resource with it, and I keep coming up against the same problem, which is that resources that belong to something don't seem to fit the pattern very well.

For example, I have lots of groups, so I have a have a groupmember resource. Group members always belong to a group, so when I use the groupmember.index route, I always need to display them by group id. Trouble is the index method hates receiving a param. I can hack it by sending a query string, or override it with a separate route declaration, but it doesn't feel right.

Also, when I edit groupmembers, I display a list of group members, which the admin can kick or give permissions to. But should the edit page of a resource show a list? this doesn't seem very restful

I feel like this is something people do every day and I'm missing the obvious or not getting the concept of restful right

Let me know your thoughts on practises for restful child resources

Ta! RexT

Please sign in or create an account to participate in this conversation.