Sha256: d319497172224f9b3af7d58606f88164752cab793b60975cd85c8b4041a35173

Contents?: true

Size: 542 Bytes

Versions: 28

Compression:

Stored size: 542 Bytes

Contents

module Workarea
  module Storefront
    class DownloadsController < Storefront::ApplicationController
      def show
        token = Fulfillment::Token.find(params[:id])
        sku = Fulfillment::Sku.find(token.sku) rescue nil

        if token&.enabled? && sku&.downloadable?
          token.inc(downloads: 1)
          send_file sku.file.file, filename: sku.file_name
        else
          flash[:info] = t('workarea.storefront.flash_messages.download_unavailable')
          redirect_to root_path
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-storefront-3.5.6 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.5 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.4 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.3 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.2 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.1 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.0 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.0.beta.1 app/controllers/workarea/storefront/downloads_controller.rb