Sha256: 7979c2d10cbb8250c5904524a2d36e7ac4425f1cbe9546b829e5ebf12fb5fa30

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

module Gluttonberg
  module Public
    class PublicAssetsController <  ActionController::Base
        # this action redirects to actual assets url. This action is accessed using 
        # short url for assets with just 4 characters from hash and id of assets
        def show
          @asset = Asset.where("id = ? AND asset_hash like ? ", params[:id].to_i, params[:hash]+'%').first
          if @asset.blank?
            render :layout => "bare", :template => 'gluttonberg/admin/exceptions/not_found.html.haml', :status => 404
            return
          end
          if params[:thumb_name].blank?
            redirect_to @asset.url
          else
            redirect_to @asset.url_for(params[:thumb_name].to_sym)
          end
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gluttonberg-core-3.0.2 app/controllers/gluttonberg/public/public_assets_controller.rb
gluttonberg-core-3.0.1 app/controllers/gluttonberg/public/public_assets_controller.rb
gluttonberg-core-3.0.0 app/controllers/gluttonberg/public/public_assets_controller.rb