Sha256: f954eb562c36cafdb14fd8aeca1f79ca73cfe2663ec4f5c1a2cef8ec71336902

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

module Shoppe
  class DeliveryServicePricesController < Shoppe::ApplicationController

    before_filter { @active_nav = :delivery_services }
    before_filter { @delivery_service = Shoppe::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 => "Price has been created successfully"
      else
        render :action => "new"
      end
    end
  
    def update
      if @delivery_service_price.update(safe_params)
        redirect_to [@delivery_service, :delivery_service_prices], :notice => "Price has been updated successfully"
      else
        render :action => "edit"
      end
    end
  
    def destroy
      @delivery_service_price.destroy
      redirect_to [@delivery_service, :delivery_service_prices], :notice => "Price has been removed successfully"
    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
shoppe-1.0.2 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-1.0.1 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-1.0.0 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.21 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.20 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.19 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.18 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.17 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.16 app/controllers/shoppe/delivery_service_prices_controller.rb
shoppe-0.0.15 app/controllers/shoppe/delivery_service_prices_controller.rb