Hope all is well.
I want to ajax call on _questions_form
. It works without remote: true
option, yet I am using actioncable
just remove the :method => :put
that you have on your form, if you will create, it needs to be post, but just remove the method part, and it will work.
thats because there is no route to /tasks
with put method when you create it with resources
Your routes.rb
should generate a routing of
PUT /tasks/complete
mapped to TasksController#complete
but your form is doing a
PUT /tasks
instead (from your log), so there's something wrong with the request (i.e. your form)
Can you try the following:
resources :tasks do
collection do
post :complete
end
end
<%= form_tag complete_tasks_path, format: :js, method: :post, remote: true do %>
<ul>
<% @in_completed_tasks.each do |task| %>
<li>
<%= check_box_tag "task_ids[]", task.id %>
<!--<input type="checkbox" name="task_ids[]" id="task_ids_" value="5">-->
<%= task.name %>
</li>
<% end %>
</ul>
<%= submit_tag "Submit your Answers" if @in_completed_tasks.present? %>
<% end %>