Your not passing a news object to your new_news_comment_path method. Dunno if that's the problem, but that is what jumped out straight away
Sent from my iPhone On 22 Nov 2010, at 17:30, Chandramouli <[email protected]> wrote: > 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. > -- 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.
