Class: MongoidForums::Admin::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/mongoid_forums/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#add_adminObject


14
15
16
17
18
# File 'app/controllers/mongoid_forums/admin/users_controller.rb', line 14

def add_admin
  @user.mongoid_admin = true
  @user.save
  redirect_to admin_users_path
end

#indexObject


9
10
11
12
# File 'app/controllers/mongoid_forums/admin/users_controller.rb', line 9

def index
  @admins = User.where(mongoid_admin: true)
  @non_admins = User.where(mongoid_admin: false)
end

#remove_adminObject


20
21
22
23
24
# File 'app/controllers/mongoid_forums/admin/users_controller.rb', line 20

def remove_admin
  @user.mongoid_admin = false
  @user.save
  redirect_to admin_users_path
end