Class: SeriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @series = Series.new(series_params)
  @series.report = @report
  respond_to do |format|
    if @series.save
      format.html { redirect_to report_series_index_url, notice: '添加成功' }
    else
      format.html { render :new }
    end
  end
end

#destroyObject



41
42
43
44
45
46
# File 'app/controllers/series_controller.rb', line 41

def destroy
  @series.destroy
  respond_to do |format|
    format.html { redirect_to report_series_index_url, notice: '删除成功' }
  end
end

#editObject



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

def edit
end

#indexObject



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

def index
  @series = @report.series
end

#newObject



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

def new
  @series = Series.new
end

#showObject



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

def show
end

#updateObject



31
32
33
34
35
36
37
38
39
# File 'app/controllers/series_controller.rb', line 31

def update
  respond_to do |format|
    if @series.update(series_params)
      format.html { redirect_to report_series_index_url, notice: '修改成功' }
    else
      format.html { render :edit }
    end
  end
end