Sha256: 6e33358fa7da2a75f467d639f060ad2e4e89aa2f615b711f226f28033a31c61b

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

module Tienda
  class DeliveryServicePricesController < Tienda::ApplicationController

    before_filter { @active_nav = :delivery_services }
    before_filter { @delivery_service = Tienda::DeliveryService.find(params[:delivery_service_id])}
    before_filter { params[:id] && @delivery_service_price = @delivery_service.delivery_service_prices.find(params[:id])}

    def index
      @delivery_service_prices = @delivery_service.delivery_service_prices.ordered
    end

    def new
      @delivery_service_price = @delivery_service.delivery_service_prices.build
    end

    def create
      @delivery_service_price = @delivery_service.delivery_service_prices.build(safe_params)
      if @delivery_service_price.save
        redirect_to [@delivery_service, :delivery_service_prices], notice: t('tienda.delivery_service_prices.create_notice')
      else
        render action: "new"
      end
    end

    def update
      if @delivery_service_price.update(safe_params)
        redirect_to [@delivery_service, :delivery_service_prices], notice: t('tienda.delivery_service_prices.update_notice')
      else
        render action: "edit"
      end
    end

    def destroy
      @delivery_service_price.destroy
      redirect_to [@delivery_service, :delivery_service_prices], notice: t('tienda.delivery_service_prices.destroy_notice')
    end

    private

    def safe_params
      params[:delivery_service_price].permit(:price, :cost_price, :tax_rate_id, :min_weight, :max_weight, :code, country_ids: [])
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tienda-2.1.3 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-2.1.2 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-2.1.1 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-2.1.0 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-2.0.2 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-2.0.1 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-1.1.2 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-1.1.1 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-1.1.0 app/controllers/tienda/delivery_service_prices_controller.rb
tienda-1.0.0 app/controllers/tienda/delivery_service_prices_controller.rb