Class: Gluttonberg::Public::PublicAssetsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/gluttonberg/public/public_assets_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

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



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/gluttonberg/public/public_assets_controller.rb', line 6

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