Class: Admin::ProgramsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/programs_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/admin/programs_controller.rb', line 19

def create
  @program = Program.new(program_params)

  respond_to do |format|
    if @program.save
      flash[:notice] = 'Program was successfully created.'
      format.html {  redirect_to(admin_program_path(@program)) }
    else
      format.html { render action: 'new' }
    end
  end
end

#editObject


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

def edit
end

#indexObject


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

def index
  @programs = Program.all
end

#newObject


12
13
14
# File 'app/controllers/admin/programs_controller.rb', line 12

def new
  @program = Program.new
end

#showObject


9
10
# File 'app/controllers/admin/programs_controller.rb', line 9

def show
end

#updateObject


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

def update
  respond_to do |format|
    if @program.update(program_params)
      flash[:notice] = 'Program was successfully updated.'
      format.html { redirect_to(admin_programs_path) }
    else
      format.html { render action: 'edit' }
    end
  end
end