diff --git a/app/controllers/origami/commissions_controller.rb b/app/controllers/origami/commissions_controller.rb index 19c6332e..f0f07d2a 100644 --- a/app/controllers/origami/commissions_controller.rb +++ b/app/controllers/origami/commissions_controller.rb @@ -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 diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d4062d26..813d46b2 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -28,6 +28,7 @@
<%= notice %>
+| Product Name | +Amount | +Commission type | +Active | ||||||
|---|---|---|---|---|---|---|---|---|---|
| <%= link_to 'Show', commission %> | -<%= link_to 'Edit', edit_origami_commission_path(commission) %> | -<%= link_to 'Destroy', commission, method: :delete, data: { confirm: 'Are you sure?' } %> | ++ <% if Product.exists? %> + <% product = Product.find(commission.product_id) %> + <%= product.name %> + <% end %> + + | +<%= commission.amount %> | +<%= commission.commission_type %> | +<%= commission.is_active %> | +<%= link_to 'Show', origami_commission_path(commission) %> | +<%= link_to 'Edit', edit_origami_commission_path(commission) %> | +<%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: { confirm: 'Are you sure?' } %> |
| Product Name | ++ <% if Product.exists? %> + <% product = Product.find(@commission.product_id) %> + <%= product.name %> + <% end %> + + |
| Amount | <%= @commission.amount %> |
| Commission Type | <%= @commission.commission_type %> |
| Active | <%= @commission.is_active %> |
| <%= link_to 'Edit', edit_origami_commission_path(@commission) %> | <%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, data: { confirm: 'Are you sure?' } %> |