Class: Exo::GridfsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/exo/gridfs_controller.rb

Instance Method Summary collapse

Instance Method Details

#assetObject



9
10
11
12
13
14
15
16
# File 'app/controllers/exo/gridfs_controller.rb', line 9

def asset
  asset = tick.site.slug_scope(Exo::Asset).find_by _id: params[:id]
  if asset
    respond_with_asset asset
  else
    render text: "Asset not found", status: 500
  end
end

#item_assetObject



3
4
5
6
7
# File 'app/controllers/exo/gridfs_controller.rb', line 3

def item_asset
  item = tick.site.resource(params[:resource_slug_id]).items.find_by slug_id: params[:item_slug_id]
  asset = item.send params[:field_slug_id].to_sym
  respond_with_asset asset
end