Sha256: 53290b2026034af9eacf3a7b5d72677648adcf25923022e638084e167eed20cb

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

module Tienda
  class DeliveryServicesController < Tienda::ApplicationController

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

    def index
      @delivery_services = Tienda::DeliveryService.all
    end

    def new
      @delivery_service = Tienda::DeliveryService.new
    end

    def create
      @delivery_service = Tienda::DeliveryService.new(safe_params)
      if @delivery_service.save
        redirect_to :delivery_services, :flash => {:notice => t('tienda.delivery_services.create_notice')}
      else
        render :action => "new"
      end
    end

    def edit
    end

    def update
      if @delivery_service.update(safe_params)
        redirect_to [:edit, @delivery_service], :flash => {:notice => t('tienda.delivery_services.update_notice')}
      else
        render :action => "edit"
      end
    end

    def destroy
      @delivery_service.destroy
      redirect_to :delivery_services, :flash => {:notice =>t('tienda.delivery_services.destroy_notice')}
    end

    private

    def safe_params
      params[:delivery_service].permit(:name, :code, :active, :default, :courier, :tracking_url)
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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