CRUDcommission

This commit is contained in:
yamin
2017-08-21 18:14:36 +06:30
parent 9d424df9fd
commit 4e29cd7cdd
7 changed files with 103 additions and 29 deletions

View File

@@ -28,7 +28,7 @@ class Origami::CommissionsController < BaseOrigamiController
respond_to do |format|
if @commission.save
format.html { redirect_to @commission, notice: 'Commission was successfully created.' }
format.html { redirect_to origami_commissions_path , notice: 'Commission was successfully created.' }
format.json { render :show, status: :created, location: @commission }
else
format.html { render :new }
@@ -42,7 +42,7 @@ class Origami::CommissionsController < BaseOrigamiController
def update
respond_to do |format|
if @commission.update(commission_params)
format.html { redirect_to @commission, notice: 'Commission was successfully updated.' }
format.html { redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.' }
format.json { render :show, status: :ok, location: @commission }
else
format.html { render :edit }
@@ -69,6 +69,6 @@ class Origami::CommissionsController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through.
def commission_params
params.fetch(:commission, {})
params.require(:commission).permit(:product_id,:amount,:commission_type, :is_active)
end
end