Class: Scholarship::TeamsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Applicat::Mvc::Controller::Resource, BaseController
Defined in:
app/controllers/scholarship/teams_controller.rb

Instance Method Summary collapse

Methods included from BaseController

#application_navigation, #navigation_product_name, #navigation_product_path

Instance Method Details

#createObject



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

def create
  @team = Scholarship::Team.new(params[:scholarship_team])
  @team.leader = current_user
  
  if @team.save
    redirect_to @team, notice: t('general.form.successfully_created')
  else
    render :new
  end
end

#destroyObject



45
46
47
48
# File 'app/controllers/scholarship/teams_controller.rb', line 45

def destroy
  @team.destroy
  redirect_to scholarship_teams_path, notice: t('general.form.destroyed')
end

#editObject



34
35
# File 'app/controllers/scholarship/teams_controller.rb', line 34

def edit
end

#indexObject



11
12
13
14
# File 'app/controllers/scholarship/teams_controller.rb', line 11

def index
  @teams = Scholarship::Team.order(:name)
  @teams = @teams.paginate(page: params[:page], per_page: 25)
end

#newObject



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

def new
  @team = Scholarship::Team.new(kind: 'sponsored')
end

#resourceObject



50
51
52
# File 'app/controllers/scholarship/teams_controller.rb', line 50

def resource
  @team
end

#showObject



16
17
# File 'app/controllers/scholarship/teams_controller.rb', line 16

def show
end

#updateObject



37
38
39
40
41
42
43
# File 'app/controllers/scholarship/teams_controller.rb', line 37

def update
  if @team.update_attributes(params[:scholarship_team])
    redirect_to @team, notice: t('general.form.successfully_updated')
  else
    render :edit
  end
end