Singular resources namespaced by its slug (Routing)

Hi,

I have the followed Rails 3 routes:

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

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

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

:controller=>“articles”}

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

:controller=>“articles”}

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

Thanks.

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