If you just give a model example, for example @user , without specifying an action (as in the first example), Rails will automatically use the appropriate CRUD action for your form:
If @user is a new, unsaved User object, the form will point to your create action.
If @user is an existing User loaded from the database, the update action will be used instead.
This has the advantage that you can reuse the same form for your edit and new views without changing the parameter :url for your forms.
As usual, the API docs provide additional information.
Pรคr wieslander
source share