Skip to content

Instantly share code, notes, and snippets.

@FernandoBasso
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FernandoBasso/9b464113064af2b02075 to your computer and use it in GitHub Desktop.
Save FernandoBasso/9b464113064af2b02075 to your computer and use it in GitHub Desktop.
<%= 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 %>
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