Rails 3由于某种原因无法呈现评论表单,表单为:
<% form_for ([@post.eng_post, @post.eng_post.eng_comments.build]) do |f| %>
但是
<%= debug @post.eng_post.eng_comments.build %>
给出
--- !ruby/object:EngComment
attributes:
id: !!null
eng_post_id: 97
full_name: !!null
website: !!null
email: !!null
comment: !!null
created_at: !!null
updated_at: !!null
模型的结构如下:
Posts (have one)-> EngPost (has many)-> EngComments
(更详细的模型在这里Rails 3, comments in a nested form, wrong routes?)
由于
答案 0 :(得分:3)
将<% form_for
替换为<%= form_for