Hi guys so apparently every newcomer knows and rages about the poor documentation that
acts_as_commentable_with_threading
provides - I'm no different.
I have a Post model, and I've made it
acts_as_commentable
as requested in the docs. Furthermore I've added the desired code in the show method for the post. Which are:
def show
@post = Post.find(params[:id])
@comments = @post.comment_threads.order('created_at desc')
@new_comment = Comment.build_from(@post, current_user, "")
end
In the show I have:
<%= form_for @new_comment do |f| %>
<%= f.label :body, 'Comment' %>
<%= f.text_area :body %>
<%= f.submit 'Post comment' %>
<% end %>
now obviously I realize I need to have a create action in the comments_controller. However I have no clue what to write in order to save the comment successfully. Any help?
You should write something like this: