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]
	@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
32
# File 'app/controllers/manage/assets_controller.rb', line 25

def destroy
  @asset.destroy
  
  respond_with(@asset) do |format|
    format.html { head :ok }
    format.xml { render :xml => @asset.to_xml }
  end
end

#sortObject



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

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