Sha256: e5a339bcec142924bb056764e6f28d4bca925fa3b9c0def27fa4bd5ab82b90a0
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
class ReportsController < ApplicationController before_action :set_report, only: [:show, :edit, :update, :destroy] layout 'report' def index @reports = Report.all end 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 def new @report = Report.new end def edit end 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 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 def destroy @report.destroy respond_to do |format| format.html { redirect_to reports_url, notice: '删除成功' } end end private def set_report @report = Report.find(params[:id]) end def report_params params.require(:report).permit(:name, :sql_code, :is_sql_category, :category_name, :connect_id, :template, :url) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
treport-0.2.0 | app/controllers/reports_controller.rb |
treport-0.1.0 | app/controllers/reports_controller.rb |