Create comment.
# File app/controllers/comments_controller.rb, line 6 def create @comment = current_user.comments.build(comment_params) if @comment.save respond_to do |format| format.js format.json end else respond_to do |format| format.js {render partial: 'form', object: @comment} end end end
Destroy comment.
# File app/controllers/comments_controller.rb, line 21 def destroy @comment = current_user.comments.find(params[:id]) @comment.destroy respond_to do |format| format.js end end