Class: Admin::ProgramsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

def edit
end

#indexObject



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

def index
  @programs = Program.all
end

#newObject



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

def new
  @program = Program.new
end

#showObject



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

def show
end

#updateObject



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

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