Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ';作为可注释的,带有线程';不保存评论_Ruby On Rails_Ruby On Rails 3_Acts As Commentable - Fatal编程技术网

Ruby on rails ';作为可注释的,带有线程';不保存评论

Ruby on rails ';作为可注释的,带有线程';不保存评论,ruby-on-rails,ruby-on-rails-3,acts-as-commentable,Ruby On Rails,Ruby On Rails 3,Acts As Commentable,这是我的表格: <%=form_for [current_user, @tattoo, @comment], :remote => false, :html =>{:multipart => true} do |f|%> <ol> <li> <%=f.hidden_field :commentable_id, :value=> @tattoo.id %><br <%=f.lab

这是我的表格:

<%=form_for [current_user, @tattoo, @comment], :remote => false, :html =>{:multipart => true} do |f|%>
  <ol>
    <li>
      <%=f.hidden_field :commentable_id, :value=> @tattoo.id %><br
      <%=f.label :body%>
      <%=f.text_area :body, :style=>"width:320;height:80px"%>
    </li>
    <li class="submit">
     <%=f.submit "Add comment"%>
    </li>
  </ol>

<%end%>
我的路线是:

resources :users do
     resources :tattoos
      resources :comments
end
表格有效,我可以提交,控制台显示:

  Parameters: {"utf8"=>"✓", "authenticity_token"=>"t6/o2soSU9fAKW/3Sro2kSbyc5WBrs/F0xMIKbwAKaU=", "comment"=>{"commentable_id"=>"4", "body"=>"sdfsdf"}, "commit"=>"Add comment", "user_id"=>"1", "tattoo_id"=>"4"

但是什么都没做,我做错了什么?

你没有打电话给
@comment.save
!天哪,我是个白痴。问题解决
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"t6/o2soSU9fAKW/3Sro2kSbyc5WBrs/F0xMIKbwAKaU=", "comment"=>{"commentable_id"=>"4", "body"=>"sdfsdf"}, "commit"=>"Add comment", "user_id"=>"1", "tattoo_id"=>"4"