Sha256: 7e7555e186d7a17779a75a3342fbb0bab403444ba414470799230244ff246d50
Contents?: true
Size: 981 Bytes
Versions: 45
Compression:
Stored size: 981 Bytes
Contents
module Spree module Admin class AdjustmentsController < ResourceController belongs_to 'spree/order', find_by: :number create.after :update_totals destroy.after :update_totals update.after :update_totals skip_before_action :load_resource, only: [:toggle_state, :edit, :update, :destroy] before_action :find_adjustment, only: [:destroy, :edit, :update] def index @adjustments = @order.all_adjustments.order(created_at: :asc) end private def find_adjustment # Need to assign to @object here to keep ResourceController happy @adjustment = @object = parent.all_adjustments.find(params[:id]) end def update_totals @order.reload.update_with_updater! end # Override method used to create a new instance to correctly # associate adjustment with order def build_resource parent.adjustments.build(order: parent) end end end end
Version data entries
45 entries across 45 versions & 2 rubygems