Prior to the update action, it did not even reach.
form_for takes a whole form_for options, actually. But almost all are optional.
- the key under which the form parameters will lie
- URL to which the form should be sent (current page by default)
- HTTP method (
GET / POST / PUT , etc., default POST )
- (and several others, but others are not relevant)
Many of them can be transferred in the form of "here's an object of the model for you, figure it out yourself" :
- The key will be the model name in
snake_case and singular. - URL:
- if
.new? on the corresponding resource модели_path - otherwise (if
.persisted? ) on the edit_модель_path(объект) corresponding resource
- Similar to the choice above,
POST or PUT respectively.
Sometimes it makes sense to set the parameters manually:
form_for :ключ, url: адрес, method: http_метод
By passing only the character, you specified only the key .
The URL and method remain the default for forms in general (current page and POST ).
But usually still use the model object. For a form, Модель.new taken for creation, and the object being edited, respectively, for editing.