'acts_as_commentable_with_threading' not saving comments
Here is my form:
&l开发者_运维知识库t;%=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%>
and my comments_controller
def create
@tattoo = Tattoo.find(params[:comment][:commentable_id])
@user = @tattoo.user_id
@user_who_commented = current_user
@comment = Comment.build_from(@tattoo, @user_who_commented.id, "Comment!" )
redirect_to(user_tattoo_path(@user, @tattoo))
end
And my routes:
resources :users do
resources :tattoos
resources :comments
end
The form works, I can submit and console shows:
Parameters: {"utf8"=>"✓", "authenticity_token"=>"t6/o2soSU9fAKW/3Sro2kSbyc5WBrs/F0xMIKbwAKaU=", "comment"=>{"commentable_id"=>"4", "body"=>"sdfsdf"}, "commit"=>"Add comment", "user_id"=>"1", "tattoo_id"=>"4"
But nothing is committed, what am I doing wrong?
精彩评论