# Getting error in using nested resource

**URL:** <https://www.ruby-forum.com/t/getting-error-in-using-nested-resource/180324>\
**Category:** Rails\
**Created:** [December 17, 2009, 2:24pm UTC](https://www.ruby-forum.com/t/getting-error-in-using-nested-resource/180324 "2009-12-17T14:24:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/71e660/32.png) [@hunt](https://www.ruby-forum.com/u/hunt)\
**Post date:** [December 17, 2009, 2:24pm UTC](https://www.ruby-forum.com/t/getting-error-in-using-nested-resource/180324/1 "2009-12-17T14:24:59Z")

</div>

map.resources :posts, has\_many :comments in route.rb

The routes are as follows…

posts GET /posts(.:format) {:controller=\>“posts”,  
:action=\>“index”}  
POST /posts(.:format) {:controller=\>“posts”,  
:action=\>“create”}  
new\_post GET /posts/new(.:format){:controller=\>“posts”,  
:action=\>“new”}  
edit\_post GET /posts/:id/edit(.:format){:controller=\>“posts”,  
:action=\>“edit”}  
post GET /posts/:id(.:format){:controller=\>“posts”, :action=\>“show”}  
PUT /posts/:id(.:format){:controller=\>“posts”, :action=\>“update”}  
DELETE /posts/:id(.:format){:controller=\>“posts”, :action=\>“destroy”}  
post\_comments GET /posts/:post\_id/comments(.:format)  
{:controller=\>“comments”, :action=\>“index”} POST  
/posts/:post\_id/comments(.:format){:controller=\>“comments”,  
:action=\>“create”}  
new\_post\_comment GET  
/posts/:post\_id/comments/new(.:format){:controller=\>“comments”,  
:action=\>“new”}  
edit\_post\_comment GET /posts/:post\_id/comments/:id/edit(.:format)  
{:controller=\>“comments”, :action=\>“edit”}  
post\_comment GET /posts/:post\_id/comments/:id(.:format)  
{:controller=\>“comments”, :action=\>“show”}  
PUT /posts/:post\_id/comments/:id(.:format)  
{:controller=\>“comments”, :action=\>“update”}  
DELETE /posts/:post\_id/comments/:id(.:format)  
{:controller=\>“comments”, :action=\>“destroy”}

\<%= form\_for @comment, :url =\> { new\_post\_comment(params[:post\_id])} do  
|f| %\>

\<%=end\>

it gives an error…

---

<div class="post-metadata">

**Author:** ![hunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/71e660/32.png) [@hunt](https://www.ruby-forum.com/u/hunt)\
**Post date:** [December 17, 2009, 3:52pm UTC](https://www.ruby-forum.com/t/getting-error-in-using-nested-resource/180324/2 "2009-12-17T15:52:24Z")

</div>

> it gives an error…

And what, pray tell, is the error it gives?
