Class: Manage::AssetsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/manage/assets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/manage/assets_controller.rb', line 9

def create
  @asset ||= @klass.new(params[:asset])
  
	@asset.assetable_type = params[:assetable_type]
@asset.assetable_id = params[:assetable_id] || 0
@asset.guid = params[:guid]
	@asset.data = params[:data_file]
	@asset.user = current_user
  @asset.save
  
  respond_with(@asset) do |format|
    format.html { head :ok }
    format.xml { render :xml => @asset.to_xml }
  end
end

#destroyObject



25
26
27
28
29
30
31
# File 'app/controllers/manage/assets_controller.rb', line 25

def destroy
  @asset.destroy
  
  respond_with(@asset) do |format|
    format.html { head :ok }
  end
end

#sortObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/manage/assets_controller.rb', line 33

def sort
  params[:picture].each_with_index do |id, index|
    @klass.move_to(index, id)
  end
  
  respond_with(@klass) do |format|
    format.html { head :ok }
  end
end