Sha256: a2a42fc831fbf24fc54bd0dfba01dcc35aae731d5dd5ba04d34ef496642699fb
Contents?: true
Size: 695 Bytes
Versions: 11
Compression:
Stored size: 695 Bytes
Contents
require_dependency "mongoid_forums/application_controller" module MongoidForums module Admin class UsersController < BaseController before_action :set_user, only: [:add_admin, :remove_admin] def index @admins = User.where(mongoid_admin: true) @non_admins = User.where(mongoid_admin: false) end def add_admin @user.mongoid_admin = true @user.save redirect_to admin_users_path end def remove_admin @user.mongoid_admin = false @user.save redirect_to admin_users_path end private def set_user @user = User.find(params[:user][:id]) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems