I am rendering a form using form_for with an existing model. I would like to submit that model and get the next action to be performed to be the 'create' action. The docs have this example:
<%= form_for @post do |f| %>
<%= f.submit %>
<% end %>
And say "In the example above, if @post is a new record, it will use “Create Post” as submit button label, otherwise, it uses “Update Post”."
I am relatively new to rails and am not sure what to make of the following stuff in the docs about customizing using I18n. How can I get the submit button to use "Create" when there's an existing record?
Clarification. . .
I the form_for is being rendered out of the new action, but I am passing it an existing object, so that fields can be prepolulated. I want it to then go to the create action, but it is going to the update instead.
Update. . .
I realize now that the issue is with the form_for and not the submit, but haven't yet figured out how to modify the form_for so that it sends to the create action.
new
action instead of theedit
action then? If youedit
a post it's kind of odd to not want toupdate
- Azolo