Jer Kehoe
Joined
410 Experience
4 Lessons Completed
0 Questions Solved
Activity
Had the same error, running on Rails 5.2, needed to replace form_for with form_with for the message form
<%= form_with model: [@chatroom, Message.new], :html => { :id => 'new_message'} do |f| %>
Also Rails UJS in 5.2 doesn't intercept a submit triggered by javascript, so I needed to use the Rails.fire() method to submit the form in my keypress handler
$(document).on "turbolinks:load", ->
$("#new_message").on "keypress", (e) ->
if e && e.keyCode == 13
e.preventDefault()
Rails.fire(this, 'submit')