Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Probably the easiest solution would not be to use :shallow option but create the same routes with additional resource definition:</p> <pre><code>map.with_options :path_prefix =&gt; "blog" do |blog| blog.resources :posts do |posts| posts.resources :comments, :only =&gt; [:index, :create, :new] end end map.resources :comments, :path_prefix =&gt; "blog", :except =&gt; [:index, :create, :new] </code></pre> <p>which gives the following routes definitions:</p> <pre><code># $ rake routes # posts GET /blog/posts(.:format) {:action=&gt;"index", :controller=&gt;"posts"} # POST /blog/posts(.:format) {:action=&gt;"create", :controller=&gt;"posts"} # new_post GET /blog/posts/new(.:format) {:action=&gt;"new", :controller=&gt;"posts"} # edit_post GET /blog/posts/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"posts"} # post GET /blog/posts/:id(.:format) {:action=&gt;"show", :controller=&gt;"posts"} # PUT /blog/posts/:id(.:format) {:action=&gt;"update", :controller=&gt;"posts"} # DELETE /blog/posts/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"posts"} # post_comments GET /blog/posts/:post_id/comments(.:format) {:action=&gt;"index", :controller=&gt;"comments"} # POST /blog/posts/:post_id/comments(.:format) {:action=&gt;"create", :controller=&gt;"comments"} # new_post_comment GET /blog/posts/:post_id/comments/new(.:format) {:action=&gt;"new", :controller=&gt;"comments"} # edit_comment GET /blog/comments/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"comments"} # comment GET /blog/comments/:id(.:format) {:action=&gt;"show", :controller=&gt;"comments"} # PUT /blog/comments/:id(.:format) {:action=&gt;"update", :controller=&gt;"comments"} # DELETE /blog/comments/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"comments"} </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload