私はポストを期待して、文字列エラーを取得し続けます。誰かが私に事前に感謝を助けることができれば。すべてのCommentsController#でActiveRecord :: AssociationTypeMismatchを作成
<% form_for :comment, :url=>{:controller=>"comments", :action=>"create"} do |f|%>
<p>
<%= f.label :body, "New Comment"%><br />
<%= f.text_area :body %>
<%= f.hidden_field :post, :value=>@post.id %>
</p>
<p><%= f.submit "Add Comment"%></p>
<% end%>
def create
@comment = Comment.create(params[:comment])
if @comment.save
redirect_to(:controller=>"posts" ,:action=>'index')
else
redirect_to(:controller=>"posts" ,:action=>'show', :id=>"post.id")
end
end
これは私に多くの助けになりました、ありがとうございます! :) – okoronkwo