In the previous article, I posted the standardization of markup. Click here ↓ ↓ https://qiita.com/kazuko___3o3___/items/019174474f4f258ba19b
Actually, this article was the main one: triumph:
The URL you want to specify is different for each new action and edit action, and at first I wrote the code with an if statement, but the error continued: cold_sweat: I will leave a memorandum of how to solve it!
Previously, I wrote an article The path automatically generated by form_for is only plural.
Therefore, the HTML is described as follows.
html:_form.html.haml
#abridgement
.new_display
= form_for @task, url: group_tasks_path do |f|
#abridgement
[Group_tasks_path] is valid only for new action, and an error will occur for edit action: scream:
Describe the ** form_for ** part described in the common view in a separate file: writing_hand:
before
html:new.html.haml/edit.html.haml
= render "form"
after
html:new.html.haml
= form_for @task, url: group_tasks_path do |f|
= render partial: "form", locals: {f: f} |= render "new_main"
html:edit.html.haml
= form_for @task, url: group_task_path do |f|
= render partial: "form", locals: {f: f} |= render "new_main"
By changing to the above contents, the new registration screen will be displayed at the time of new action, the edit screen (including the input contents will be reflected) at the time of edit action, and create and update were perfect: laughing:
https://qiita.com/seiya1121/items/fba02afcd8d54f1628ba