我的 Rails 版本 5.2.0
form_for 表单代码:
<%= form_for [@chatroom, Message.new], remote: true, method: :post do |f|%><br>
<%= f.text_area :body, rows: 1, class: "form-control", autofocus: true %><br>
<% end %>
js 代码:
$("#new_message").submit()
请求过程如下
Started GET "/chatrooms/1/messages" for 127.0.0.1 at 2018-04-26 23:35:35 +0800<br>
Processing by MessagesController#create as <strong>HTML</strong>
竟然是 html 而不是 js。请问是不是与 rails-ujs 相关,具体是啥原因,该如何解决这个问题?