Class: Admin::SetupController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/setup_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/admin/setup_controller.rb', line 14

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

#newObject



5
6
7
8
9
10
11
12
# File 'app/controllers/admin/setup_controller.rb', line 5

def new
  if SpudUser.count != 0
    flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
    redirect_to  and return
  else
    @spud_user = SpudUser.new  
  end
end