Another approach is to go ahead an proactively implement controller
actions for those that shouldn’t be called, and return a 401 status or
something appropriate, by calling the “head” method to return a status
code.
Jeff
This is the approach I have taken. Thanks for the inputs.
You can just ignore them. If you don’t implement the #edit and #destroy
actions in your controller, the routes won’t do anything. I’ve thought
about an :only or :except option for map.resources, but it seems like
overkill.
I agree.
Another approach is to go ahead an proactively implement controller
actions for those that shouldn’t be called, and return a 401 status or
something appropriate, by calling the “head” method to return a status
code.
I’m my case, I don’t want GET /resource/:id;edit and DELETE /
resource/:id
;edit is not needed for my app, and DELETE is not allowed.
Do I have create all the routes by hand? Or can I pass some kind of
except parameter to map.resources?
Ryan
You can just ignore them. If you don’t implement the #edit and #destroy
actions in your controller, the routes won’t do anything. I’ve thought
about an :only or :except option for map.resources, but it seems like
overkill. If the presence of the superfluous routes really offends you,
you could remove them from the routes array with a bit of hackery, but
aside from a few more CPU cycles to not match the routes, they aren’t
hurting anyone by being there.