Sha256: cca8633630cbe4c3763cf373c87cd37ed7c1149f7b5f385319cac1319325cbeb
Contents?: true
Size: 870 Bytes
Versions: 2
Compression:
Stored size: 870 Bytes
Contents
class Admin::UsersController < ApplicationController before_action { |c| c.authorize_level(1) } layout 'admin' def index @table = Table.new(self, User) @table.respond end def new @user = User.new end def create @user = User.new(user_params) if @user.save redirect_to admin_users_path, success: t('user.admin.new.success') else render 'new' end end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(user_params) redirect_to admin_users_path, success: t('user.admin.edit.success') else render 'edit' end end def destroy User.find(params[:id]).destroy redirect_to admin_activities_path, success: t('user.admin.destroy.success') end private def user_params params.require(:user).permit(:name, :level, :password, :password_confirmation) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
snapuser-0.1.1 | app/controllers/admin/users_controller.rb |
snapuser-0.1.0 | app/controllers/admin/users_controller.rb |