Sha256: 7ec3dfa620e40b97e7d8276da1674ebd46aeccca2aa9a83734668eca6802314f
Contents?: true
Size: 758 Bytes
Versions: 13
Compression:
Stored size: 758 Bytes
Contents
class Admin::SetupController < Admin::ApplicationController skip_before_action :require_user, :require_admin_user def new if SpudUser.count != 0 flash[:error] = "Access Denied! This wizard may only be executed when the database is empty." redirect_to admin_login_path and return else @spud_user = SpudUser.new end end def create @spud_user = SpudUser.new(user_params) @spud_user.super_admin = true if @spud_user.save SpudUserSession.create(@spud_user) redirect_to admin_root_path else render 'new', :status => 422 end end private def user_params params.require(:spud_user).permit(:login, :email, :password, :password_confirmation, :first_name, :last_name) end end
Version data entries
13 entries across 13 versions & 1 rubygems