> In the meantime, if you use the resources() helper but don't define the > methods in your controller, the URLs will not be active (because the > controller/action pair returned by the router will not be valid).
A missing method or invalid route raises a different sort of exception though. Wouldn't it be better to have an existing controller that simply raises NotFound? That seems like the "safest" way to handle it. > I don't think there is a need to manually remove routes - if you don't > want to offer a particular action just don't write methods that you > don't want for the particular controller. Is there an advantage to this approach versus having a method that simply raises NotFound though? It might be because I've only worked in the development environment where the errors are verbose, but doesn't that raise an InternalServerError when in production? It just seems like if someone is familiar with Rails or such they can poke around. In the end it's probably harmless, but I like to expose as little as possible. If missing controller methods already raise NotFound or if there is a configuration level way to force them too then that's pay dirt for me! > If you want to find by "slug" rather than "id" you could do something > like, "resources :article, :identify => :slug", and resouce(@article) > will generate "/articles/my-slug" My manually set routes do something similar. It took me a bit of messing around to get the router doing what I want, but now that I get the basics (watching the Merb Camp presentation demonstrated a number of things I haven't tried and don't get yet) I'm really happy with Merb's routes. > If Merb is similar to Rails in this regard, the method > "resources :resource" is just an easy way of specifying restful > routes, and it doesn't do anything special that you can't do manually. I'll keep that in mind. I was thinking that was probably the case, but I don't have any Rails experience to fall back on! Django routes are more primitive than Merb's. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
