Class: Admin::UserGroupsController

Inherits:
ForestController
  • Object
show all
Includes:
FilterControllerScopes
Defined in:
app/controllers/admin/user_groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /user_groups



31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/admin/user_groups_controller.rb', line 31

def create
  @user_group = UserGroup.new(user_group_params)
  authorize @user_group

  if @user_group.save
    redirect_to edit_admin_user_group_path(@user_group), notice: 'User group was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /user_groups/1



53
54
55
56
57
# File 'app/controllers/admin/user_groups_controller.rb', line 53

def destroy
  authorize @user_group
  @user_group.destroy
  redirect_to admin_user_groups_url, notice: 'User group was successfully destroyed.'
end

#editObject

GET /user_groups/1/edit



26
27
28
# File 'app/controllers/admin/user_groups_controller.rb', line 26

def edit
  authorize @user_group
end

#indexObject

GET /user_groups



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

def index
  @user_groups = apply_scopes(UserGroup).by_name.page params[:page]
  authorize @user_groups
end

#newObject

GET /user_groups/new



20
21
22
23
# File 'app/controllers/admin/user_groups_controller.rb', line 20

def new
  @user_group = UserGroup.new
  authorize @user_group
end

#showObject

GET /user_groups/1



15
16
17
# File 'app/controllers/admin/user_groups_controller.rb', line 15

def show
  authorize @user_group
end

#updateObject

PATCH/PUT /user_groups/1



43
44
45
46
47
48
49
50
# File 'app/controllers/admin/user_groups_controller.rb', line 43

def update
  authorize @user_group
  if @user_group.update(user_group_params)
    redirect_to edit_admin_user_group_path(@user_group), notice: 'User group was successfully updated.'
  else
    render :edit
  end
end