Class: ReportsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ReportsController
- Defined in:
- app/controllers/reports_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/reports_controller.rb', line 25 def create @report = Report.new(report_params) respond_to do |format| if @report.save format.html { redirect_to reports_url, notice: '添加成功' } else format.html { render :new } end end end |
#destroy ⇒ Object
47 48 49 50 51 52 |
# File 'app/controllers/reports_controller.rb', line 47 def destroy @report.destroy respond_to do |format| format.html { redirect_to reports_url, notice: '删除成功' } end end |
#edit ⇒ Object
22 23 |
# File 'app/controllers/reports_controller.rb', line 22 def edit end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/reports_controller.rb', line 4 def index @reports = Report.all end |
#new ⇒ Object
18 19 20 |
# File 'app/controllers/reports_controller.rb', line 18 def new @report = Report.new end |
#show ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/reports_controller.rb', line 8 def show @data = @report.report_date(params) #@result = @report.get_chart_date(params) if @report.template.blank? render text: "没有模板,请先添加report模板" else render @report.template end end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/reports_controller.rb', line 37 def update respond_to do |format| if @report.update(report_params) format.html { redirect_to reports_url, notice: '修改成功' } else format.html { render :edit } end end end |