私はモデルを持っています
class Rcomment < ActiveRecord::Base
attr_accessible :comment, :rating
belongs_to :recipe
belongs_to :user
end
レシピの表示ビューからコメントを追加しようとしています。rcomment テーブルにダミー データを入力しましたが、次の方法で問題なく表示されます。
@recipe = Recipe.find(params[:id])
@comments = @recipe.rcomments
だから私は @newcomments = @recipe.rcomments.build(params[:recipe]) を試しました
しかし、エラーでまったく機能しません: #<#:0x25ccd10> のメソッド `rcomments_path' が未定義です。
使用可能な form_for を表示するにはどうすればよいですか?
%= form_for(@newcomments) do |f| %>
<%= f.label :Comments %>
<%= f.text_field :comment%>
<%= f.label :ratings %>
<%= f.text_field :rating %>
<%= f.submit "Submit Comment", class: "btn btn-large btn-primary" %>
<% end %>