标签:edit cti rails perm control esc font str upd
class InvoicesController < ApplicationController
def index
@invoices = Invoice.all
end
def show
@invoice = Invoice.find(params[:id])
end
def new
@invoice = Invoice.new
end
def edit
@invoice = Invoice.find(params[:id])
end
def update
@invoice = Invoice.find(params[:id])
if @invoice.update(invoice_params)
redirect_to invoice_path(@invoice)
else
render :edit
end
end
def create
@invoice = Invoice.new(invoice_params)
if @invoice.save
redirect_to @invoice
else
render :new
end
end
def destroy
@invoice = Invoice.find(params[:id])
@invoice.destroy
redirect_to :action => :index
end
private
def invoice_params
params.require(:invoice).permit(:standard, :unit, :amount, :tax_unit_price, :tax_total, :cess, :tax_money)
end
end
标签:edit cti rails perm control esc font str upd
原文地址:https://www.cnblogs.com/znsongshu/p/9726959.html