title: Rails nesting scope block in resources
body: <p>I'm trying to create a path like <code>product/:id/monthly/revenue/</code> and <code>product/:id/monthly/items_sold</code> and the equivalent named routes <code>product_monthly_revenue</code> and <code>product_monthly_items_sold</code>, and these routes would simply show the charts. I tried</p>
  
  <pre><code>resources :products do
      scope 'monthly' do
          match 'revenue', to: "charts#monthly_revenue", via: 'get'
          match 'items_sold', to: "charts#monthly_items_sold", via: 'get'
      end
  end
  </code></pre>
  
  <p>But this gives me the routes:</p>
  
  <pre><code>product_revenue    GET    /monthly/products/:product_id/revenue(.:format)    charts#monthly_revenue
  product_items_sold GET    /monthly/products/:product_id/items_sold(.:format) charts#monthly_items_sold
  </code></pre>
  
  <p>where <code>monthly</code> gets appended in front instead, and the route naming is off. I know I could just do:</p>
  
  <pre><code>resources :products do
      match 'monthly/revenue', to: "charts#monthly_revenue", via: 'get', as: :monthly_revenue
      match 'monthly/items_sold', to: "charts#monthly_items_sold", via: 'get', as: :monthly_items_sold
  end
  </code></pre>
  
  <p>but that isn't DRY, and it gets crazy when I try to add more categories like yearly. Using a namespace would force me to create a new controller for each namespace, when I want to consolidate all the charts into a single controller.</p>
  
  <p>So I guess the summarised question would be: is it possible to namespace routes without namspacing controllers? Or is it possible to consolidate the creation of categories of named routes?</p>
  
  <p><strong>Edit</strong>: Using</p>
  
  <pre><code>resources :products do
    scope "monthly", as: :monthly, path: "monthly" do
      match 'revenue', to: "charts#monthly_revenue", via: 'get'
      match 'items_sold', to: "charts#monthly_items_sold", via: 'get'
    end
  end
  </code></pre>
  
  <p>would give me the routes</p>
  
  <pre><code>   monthly_product_revenue GET    /monthly/products/:product_id/revenue(.:format)    charts#monthly_revenue
  monthly_product_items_sold GET    /monthly/products/:product_id/items_sold(.:format) charts#monthly_items_sold
  </code></pre>
  
  <p>which similar to the first block, is unexpected because I expect that if a scope is nested in a resources block, only the routes in the scope block would affected by the the scope, not the resources block.</p>
  
  <p><strong>Edit 2</strong>: Forgot to include this information earlier, but I'm on Rails 4.0.0, with Ruby 2.0.0-p247</p>