Class: GroupsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

post /groups



11
12
13
14
15
16
17
18
# File 'app/controllers/groups_controller.rb', line 11

def create
  @entity = Group.new(entity_parameters)
  if @entity.save
    redirect_to(admin_group_path(id: @entity.id))
  else
    render :new, status: :bad_request
  end
end

#destroyObject

delete /groups/:id



34
35
36
37
38
39
# File 'app/controllers/groups_controller.rb', line 34

def destroy
  if @entity.destroy
    flash[:notice] = t('groups.destroy.success')
  end
  redirect_to admin_groups_path
end

#editObject

get /groups/:id/edit



21
22
# File 'app/controllers/groups_controller.rb', line 21

def edit
end

#newObject

get /groups/new



6
7
8
# File 'app/controllers/groups_controller.rb', line 6

def new
  @entity = Group.new
end

#updateObject

patch /groups/:id



25
26
27
28
29
30
31
# File 'app/controllers/groups_controller.rb', line 25

def update
  if @entity.update(entity_parameters)
    redirect_to admin_group_path(id: @entity.id), notice: t('groups.update.success')
  else
    render :edit, status: :bad_request
  end
end