How do I do that? 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can pass restricted: :restricted=>/new|create/ On Aug 8, 10:38 am, Ryan <Ryan.Warner...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How do I do that? > > 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Josh Susser
2007-Aug-08 19:18 UTC
Re: I want most, but not all routes created by map.resources
Ryan wrote:> How do I do that? > > 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? > > RyanYou 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. -- Josh Susser http://blog.hasmanythrough.com -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 8, 2:18 pm, Josh Susser <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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. Jeff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 8, 6:44 pm, Jeff <cohen.j...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. > > JeffThis is the approach I have taken. Thanks for the inputs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---