Ruby on rails ActionController::UnknownFormat,format.js

Ruby on rails ActionController::UnknownFormat,format.js,ruby-on-rails,Ruby On Rails,我正在Rails中制作Instagram副本,在向帖子添加评论(以及在没有重定向的情况下更新视图)时遇到了一些麻烦。我在视图中有以下代码: <%= form_for(:comments, url: comment_path(post_id: post.id), method: :post, remote: true, id: "comment-form" ) do |f| %> <%= f.text_area :comme

我正在Rails中制作Instagram副本,在向帖子添加评论(以及在没有重定向的情况下更新视图)时遇到了一些麻烦。我在视图中有以下代码:

      <%= form_for(:comments, url: comment_path(post_id: post.id), method: :post, remote: true, id: "comment-form" ) do |f| %>
            <%= f.text_area :comment, :id => "comment", rows: "1", :placeholder => "New comment..." , class: 'form-control' %>
      <% end %>
问题是,当我按enter键插入注释时,遇到以下错误:


有人知道这是什么吗?我怀疑它与表单_for有关(因为我有一个链接_指向它,它做的事情和它的工作几乎完全相同),但我不确定。谢谢

当请求到来时粘贴完整的日志
def save_comment
    @comment = Comment.new(user_id: current_user.id, post_id: params[:post_id], comment: params[:comments][:comment])
    if @comment.save
        @success = true
    end 
    respond_to do |format|
        format.js {render 'posts/comment'}
    end    
end