Sha256: 68a46c96744f166ba56c2d94de904d471a991da49f6c16f2c313c4b6e46609ff
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
module CitizenBudgetModel class UsersController < CitizenBudgetModelController before_action :authenticate_user! before_action :set_user, only: [:show, :edit, :update, :destroy] def index @users = collection.all.sort_by(&:email) end def new @user = collection.new end def edit end def create @user = collection.new(user_params) if @user.save redirect_to users_path, notice: _('User was created.') else render :new end end def update if @user.update(user_params) redirect_to users_path, notice: _('User was updated.') else render :edit end end private def collection @collection ||= users end def set_user @user = collection.find(params[:id]) end def user_params attribute_names = [:email, :password, :password_confirmation] if admin? attribute_names << :organization_id end params.require(:user).permit(*attribute_names) end end end
Version data entries
4 entries across 4 versions & 1 rubygems