I have this in my view; I made the "new" and "edit" views similar with only the following snippet which dictates if the form is a patch or a post.
<% @selected_holiday[:id].present? ? (current_method = :patch) : (current_method = :post) %>
<%=
form_tag( {method: current_method},
class: 'create_form',
id: "new_holiday_form",
:"data-parsley-validate" => "" ) do
%>
My routes contains:
human_resources_settings_holidays GET /human_resources/settings/holidays(.:format) human_resources/settings/holidays#index
POST /human_resources/settings/holidays(.:format) human_resources/settings/holidays#create
new_human_resources_settings_holiday GET /human_resources/settings/holidays/new(.:format) human_resources/settings/holidays#new
edit_human_resources_settings_holiday GET /human_resources/settings/holidays/:id/edit(.:format) human_resources/settings/holidays#edit
human_resources_settings_holiday GET /human_resources/settings/holidays/:id(.:format) human_resources/settings/holidays#show
PATCH /human_resources/settings/holidays/:id(.:format) human_resources/settings/holidays#update
PUT /human_resources/settings/holidays/:id(.:format) human_resources/settings/holidays#update
Yet from
http://localhost:3000/human_resources/settings/holidays/7d525fe6-b1e7-11e5-b6e8-00ff6a8ddd39/edit
I get:
http://localhost:3000/human_resources/settings/holidays/7d525fe6-b1e7-11e5-b6e8-00ff6a8ddd39/edit?method=patch
and therefore:
The action '7d525fe6-b1e7-11e5-b6e8-00ff6a8ddd39' could not be found for HumanResources::Settings::HolidaysController
How do I not hit the edit path and go through the PATCH?