I'm trying to create comment, through form_for of 3 levels:
Article > Item > Comment
Controller:
def new
@comment = Comment.new
end
I have already tried it in several ways, and all of them give error. Look at what I tried and the error that returned:
1st try:
<%= form_for([@item, @item.comments.build]) do |f| %>
Error: undefined method 'item_comments_path' for
2nd attempt:
<%= form_for ([@item, @comment]) do |f| %>
Error: First argument in form can not contain nil or be empty
3rd Try:
<%= form_for @category do |f| %>
<%= f.fields_for @item do |i| %>
<%= i.fields_for @comments do |c| %>
Error: undefined method 'model_name' for nil: NilClass
I do not know what to try, how could I solve this?