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…