Sha256: c763ad0cdecc4d517e55a6b5abb6cab4a20d8e648afb119cd713d56e599bad3c

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

module Spree
  module Admin
    class VolumePriceModelsController < ResourceController

      before_action :load_volume_prices, only: [:new, :edit]
      respond_to :json, only: [:get_children]

      def get_children
        @volume_prices = VolumePrice.find(params[:parent_id]).children
      end

      private

      def location_after_save
        if @volume_price_model.created_at == @volume_price_model.updated_at
          edit_admin_volume_price_model_url(@volume_price_model)
        else
          admin_volume_price_models_url
        end
      end

      def load_volume_prices
        @volume_price_model.volume_prices.build if @volume_price_model.volume_prices.empty?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_volume_pricing-0.2.0 app/controllers/spree/admin/volume_price_models_controller.rb
solidus_volume_pricing-0.1.0 app/controllers/spree/admin/volume_price_models_controller.rb