Class: TeamsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

post /teams



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

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

#destroyObject

delete /teams/:id



33
34
35
36
37
38
# File 'app/controllers/teams_controller.rb', line 33

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

#editObject

get /teams/:id/edit



20
21
# File 'app/controllers/teams_controller.rb', line 20

def edit
end

#newObject

get /teams/new



5
6
7
# File 'app/controllers/teams_controller.rb', line 5

def new
  @entity = Team.new
end

#updateObject

patch /teams/:id



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

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