Hello, I am following a railscasts guide ( http://asciicasts.com/episodes/154-polymorphic-association ) for making comments for different models, but I have run into a problem.
When I try to go to localhost:3000/articles/id/comments/new, I get the following error:
undefined method `comments_path' for #<#<Class:0xb608b40>:0xb607a60>
It is coming from my comment form:
1: <%= form_for([@commentable, @comment]) do |f| %>
2: <%#= render 'shared/error_messages', :object => f.object %>
3: <div class="field">
4: <%= f.label :title %><br />
Here are the contents of the new method of the comments controller:
def new
@comment = Comment.new
end
One thing that differs from the cast, my routes.db has this:
resources :articles do
resources :comments
end
instead of this:
resources :articles, :has_many => :comments
I get a routes error if I do not do it like this.
Any idea why? I know the guide is a little old, and I am on Rails 3.