Created
May 9, 2013 17:34
-
-
Save delba/5549106 to your computer and use it in GitHub Desktop.
Using multiple submit buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ItemsController < ApplicationController | |
| def create | |
| @item = Item.create!(item_params) | |
| end | |
| private | |
| def item_params | |
| params.require(:item).permit(:name, :public) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for @item do |f| %> | |
| <%= f.label :name %> | |
| <%= f.text_field :name %> | |
| <%= f.button "Create Private Item", name: "item[public]", value: false %> | |
| <%= f.button "Create Public Item", name: "item[public]", value: true %> | |
| <% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment