title: How to get pretty Grape API routes to a nested collection
body: <p>In the swagger pic below, my endpoint for listing a <code>project</code>'s <code>campaigns</code> is returning the intended data, but the url has unwanted segments.</p>
  
  <p>How can I structure the code in order to have nested collections or such endpoints come as appendages to the parent model's id: <code>/api/v1/projects/{id}/campaigns</code> ?</p>
  
  <p><a href="https://i.stack.imgur.com/nr1UV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nr1UV.jpg" alt="enter image description here"></a></p>
  
  <pre><code>module API                                                                                                                                                                                                         
    module V1                                                                                                                                                                                                        
      class Projects &lt; Grape::API                                                                                                                                                                                    
        include API::V1::Defaults                                                                                                                                                                                    
  
        resource :projects do                                                                                                                                                                                        
          desc "Return all projects"                                                                                                                                                                                 
          get "", root: :projects do                                                                                                                                                                                 
            Project.all                                                                                                                                                                                              
          end                                                                                                                                                                                                        
  
          desc "Return a project"                                                                                                                                                                                    
          params do                                                                                                                                                                                                  
            requires :id, type: String, desc: "ID of the project"                                                                                                                                                    
          end                                                                                                                                                                                                        
  
          get ":id", root: "project" do                                                                                                                                                                              
            Project.where(id: permitted_params[:id]).first!                                                                                                                                                          
          end                                                                                                                                                                                                        
  
          resource :campaigns do                                                                                                                                                                                     
            desc "Return all campaigns for a project"                                                                                                                                                                
            get ":id/campaigns", root: "project" do                                                                                                                                                                  
              Project.find(params[:id]).campaigns                                                                                                                                                                    
            end                                                                                                                                                                                                      
          end                                                                                                                                                                                                        
  
        end                                                                                                                                                                                                          
      end                                                                                                                                                                                                            
    end                                                                                                                                                                                                              
  end  
  </code></pre>