我有一个表单,它是“评论”对象的一部分,它是“后”对象的孩子,后者又是孩子的“类别”对象,我得到上面的错误消息与下面的代码(使用simple_forms)任何建议?未定义的方法`post_comments_path'为#<#<Class:0xa3ddb8c>:0xb501ae4>
= simple_form_for([@post, @post.comments.build], html: {class: 'form-horizontal'}) do |f|
= f.input :comment, label: "Your Reply", input_html: {class: "form-control"}
= f.submit
的routes.rb:
Rails.application.routes.draw do
devise_for :users
resources :categories do
resources :posts do
resources :comments
end
end
root 'categories#index'
end
请提供你的'配置/ routes.rb'。 –
发布你的config/routes.rb文件的相关部分 –
@Longhanks,请在你的文章中添加路由,而不是在这里。 –