Last active
August 29, 2015 14:25
-
-
Save FernandoBasso/9b464113064af2b02075 to your computer and use it in GitHub Desktop.
This file contains 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 @user_category do |f| %> | |
<p> | |
<%= f.label :description %> | |
<%= f.text_field :description %> | |
</p> | |
<p> | |
<%= f.radio_button :status, true, :id => 'status_true' %> | |
<%= f.label 'Ativo', :for => 'status_true' %> | |
<%= f.radio_button :status, false, :id => 'status_false' %> | |
<%= f.label 'Inativo', :for => 'status_false' %> | |
</p> | |
<p> | |
<%= f.submit 'OK' %> | |
</p> | |
<% end %> |
This file contains 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 Admin::UserCategoriesController < ApplicationController | |
def index | |
end | |
def new | |
@user_category = Admin::UserCategory.new | |
end | |
def create | |
render plain: params[:user_category].inspect | |
return | |
@user_category = Admin::UserCategory.new(user_categories_params) | |
if @user_category.save | |
redirect_to @user_category | |
else | |
render 'new' | |
end | |
end | |
private | |
def user_categories_params | |
params.require(:user_category).permit(:description, :status) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment