404 error when submitting forms / chat messages

93 Views Asked by At

I'm very new at Ruby on Rails and I'm trying to follow this tutorial (https://scotch.io/tutorials/asynchronous-chat-with-rails-and-actioncable?fbclid=IwAR19UbyiXHkG8OvSrZ1jXJr5gFK8lnjkqEFdMxaYYMyFisKmwlAXQbyx_GU). I have the Clearance gem setup just fine and a form to submit a message shows up properly, but if I try to submit a message, I get a 404 error.

Full error from inspect element: rails-ujs.self-2b8935521e2301b06b45bd42e623eb0c0acf76c3a6ba383b7429c6a2884f8c23.js?body=1:217 POST http://localhost:3000/ 404 (Not Found) Rails.ajax @ rails-ujs.self-2b8935521e2301b06b45bd42e623eb0c0acf76c3a6ba383b7429c6a2884f8c23.js?body=1:217 Rails.handleRemote @ rails-ujs.self-2b8935521e2301b06b45bd42e623eb0c0acf76c3a6ba383b7429c6a2884f8c23.js?body=1:573 (anonymous) @ rails-ujs.self-2b8935521e2301b06b45bd42e623eb0c0acf76c3a6ba383b7429c6a2884f8c23.js?body=1:174

views/chats/index.html.erb

<h1>Demo Chat</h1>

<div id="messages">
  <%= render @messages %>
</div>

<%= form_with url: '#', html: {id: 'new-message'} do |f| %>
  <%= f.label :body %>
  <%= f.text_area :body, id: 'message-body' %>
  <br>
  <%= f.submit %>
<% end %>
0

There are 0 best solutions below