Class: Geri::Admin::AdminUsersController

Inherits:
Geri::AdminController show all
Defined in:
app/controllers/geri/admin/admin_users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 27

def create
  @admin_user = AdminUser.new(admin_user_params)
  if @admin_user.save
    flash[:success] = 'The Admin User was sucessfully created, an email confirmation has been sent with ' +
      'instructions for setting their password!'
    return redirect_to admin_admin_users_path
  end
  render :new
end

#destroyObject



37
38
39
40
41
42
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 37

def destroy
  @admin_user = AdminUser.find(params[:id])
  @admin_user.delete
  flash[:success] = 'The Admin User was successfully deleted.'
  redirect_to admin_admin_users_path
end

#editObject



13
14
15
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 13

def edit
  @admin_user = AdminUser.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 5

def index
  @admin_users = AdminUser.all
end

#newObject



9
10
11
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 9

def new
  @admin_user = AdminUser.new
end

#updateObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/geri/admin/admin_users_controller.rb', line 17

def update
  @admin_user = AdminUser.find(params[:id])
  if @admin_user
    .update_attributes(current_user == @admin_user ? admin_user_params_with_password : admin_user_params)
    flash[:success] = 'The Admin User was successfully updated.'
    return redirect_to edit_admin_admin_user_path(@admin_user)
  end
  render :edit
end