Hi
I am stuck with nested routing
I started with a fresh project:
And used scaffolding to put together two models
rails generate scaffold News title:string story:text
rails generate scaffold Comment news_id:integer content:text
now I set up the associations
Comment :belongs_to News
News :has_many :comments
And now I have wrote the nested routes as
resources :news do
resources :comments
end
I ran rake routes and it shows all the nested routes like
new_news_comment GET /news/:news_id/comments/new(.:format)
{:action=>"new", :controller=>"comments"}
yet when I use the link
<%= link_to 'Comment', new_news_comment_path%>
and try to render it
it throws the error
No route matches {:controller=>"comments", :action=>"new"}
Do any of you see where I might be making a mistake? Or if my
understanding of nested routes is flawed.
--
You received this message because you are subscribed to the Google Groups
"NWRUG" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nwrug-members?hl=en.