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.
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"

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.

match("articles/:slug").to(:controller => 'articles', :action =>
'show').name(:article)

Hope that helps.


On Dec 16, 9:36 pm, cult hero <[email protected]> wrote:
> Let's say I go ahead and use "resources <resource>" in my router.rb to
> create some generic routes for something but I only want a subset of
> those routes. (For instance, let's say I don't want to "show" by id,
> but rather, by a slug field.)
>
> Should I create my routes from scratch or is there a good way of
> removing a couple of the routes generated by the resources method? I
> was thinking you could create a controller that just automatically
> raises a NotFound exception, but that seems like a bit of a kludge.
>
> Part of this question comes from me trying to understand CRUD in merb
> but the examples on the wiki all seem to be based around resources
> which is adding an extra layer of stuff for me to grok.
>
> (As a side note, I'm coming from a limited Django background and NOT a
> Rails background, so a lot of these conventions are quite a bit more
> foreign to me than they might be to others.)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to