Sha256: 82c537fb44fc88573a7326c23fecf2a74c584ff2283d286faa2f5f99fcea9261
Contents?: true
Size: 738 Bytes
Versions: 15
Compression:
Stored size: 738 Bytes
Contents
class UsersController < ApplicationController before_filter :authenticate_user! after_action :verify_authorized def index @users = User.all authorize User end def show @user = User.find(params[:id]) authorize @user end def update @user = User.find(params[:id]) authorize @user if @user.update_attributes(secure_params) redirect_to users_path, :notice => "User updated." else redirect_to users_path, :alert => "Unable to update user." end end def destroy user = User.find(params[:id]) authorize user user.destroy redirect_to users_path, :notice => "User deleted." end private def secure_params params.require(:user).permit(:role) end end
Version data entries
15 entries across 15 versions & 1 rubygems