Creating a resource, setting a primary endpoint, and then using ResourceName.find({id: id}) doesn't work if the controller is set up as a show action.
You get ResourceName cannot be called directly from endpoint /api/v1/resource#show!
This is why.
A workaround is to either go with self.validate_endpoints = false or change the action to be an index action, which bypasses the stripping of a would-be id.
This PR changes the behavior to only strip the id from path if the id is actually in path!
Creating a resource, setting a primary endpoint, and then using
ResourceName.find({id: id})
doesn't work if the controller is set up as ashow
action. You getResourceName cannot be called directly from endpoint /api/v1/resource#show!
This is why. A workaround is to either go with
self.validate_endpoints = false
or change the action to be anindex
action, which bypasses the stripping of a would-be id.This PR changes the behavior to only strip the
id
frompath
if the id is actually inpath
!