Sha256: 58a135d24831da5cea38828b0855acf8e52132b3f1949f3ec13854dc544435f3
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require_dependency "storytime/application_controller" module Storytime module Dashboard class UsersController < DashboardController before_action :load_user, only: [:edit, :update, :destroy] respond_to :json, only: :destroy def index @users = Storytime.user_class.all authorize @users end def new @user = Storytime.user_class.new authorize @user end def create @user = Storytime.user_class.new(user_params) authorize @user if @user.save redirect_to dashboard_users_path, notice: I18n.t('flash.users.create.success') else render :new end end def edit authorize @user end def update authorize @user if @user.update(user_params) redirect_to dashboard_users_path, notice: I18n.t('flash.users.update.success') else render :edit end end def destroy authorize @user @user.destroy respond_with @user end private def user_params params.require(:user).permit(:email, :storytime_role_id, :password, :password_confirmation) end def load_user @user = Storytime.user_class.find(params[:id]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
storytime-0.0.2 | app/controllers/storytime/dashboard/users_controller.rb |