Singular resources namespaced by its slug (Routing)


I have the followed Rails 3 routes:

Hello::Application.routes.draw do
  resources :blogs do
    resources :articles do
      resources :comments

By raking them, we can find (for instance):

GET    /blogs/:blog_id/articles(.:format)      {:action=>"index",


Because every routes begin with the same root path (/blogs), I would
like to shorten addresses by removing it (when :blog_id is given).

In this why, I could have thoses routes (I think it’s more DRY):

GET    /:blog_id/articles(.:format)      {:action=>"index",


According to you, what kind of change I should make over my current
routes configuration?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs