Reputation: 1295
I have this code for my _form.html.haml:
= form_tag edit_work_flows_path, :method=> 'put' do |f|
-@all_configurations.each do |config|
-if config.configuration_key == 'DUPLICATE_CLAIM_WI_MANAGER'
=hidden_field_tag "config_ids[]", config.id
.fieldset.field-group.field-group-inline.pull-left
.field.field-text
%label= t('workflow.duplicate_claim_manager')
It is giving the error that "No route matches [PUT]"
However, when I change the form_tag to app_configurations_path
it works. But it doesn't go to the page I want. I want it to go to the edit_work_flows_path page. Here is my route:
scope '/settings' do
resource :app_configurations, only: [:edit, :update] do
collection { get 'cover_letter_template' }
end
resource :work_flows, only: [:edit, :update]
end
Any idea how to fix this?
Upvotes: 3
Views: 965
Reputation: 33542
No route matches [PUT]
The problem is with your form_tag
. When you run rake routes
, you will see like the below
Prefix Verb URI Pattern Controller#Action
edit_work_flows GET /work_flows/edit(.:format) work_flows#edit
work_flows PATCH /work_flows(.:format) work_flows#update
PUT /work_flows(.:format) work_flows#update
This means the edit_work_flows_path
can only accept GET
, that is why you got the error. You should change edit_work_flows_path
to work_flows_path
. The below code should work.
= form_tag work_flows_path, :method=> 'put' do |f|
Upvotes: 4