Class: Kuhsaft::Admin::AssetsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/kuhsaft/admin/assets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 17

def create
  @asset = Kuhsaft::Asset.create params[:kuhsaft_asset]
  @asset.save
  respond_with @asset, :location => admin_assets_path
end

#destroyObject



34
35
36
37
38
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 34

def destroy
  @asset = Kuhsaft::Asset.find(params[:id])
  @asset.destroy
  redirect_to admin_assets_path
end

#editObject



23
24
25
26
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 23

def edit
  @asset = Kuhsaft::Asset.find(params[:id])
  respond_with @asset
end

#indexObject



7
8
9
10
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 7

def index
  @assets = Kuhsaft::Asset.by_date
  respond_with @assets
end

#newObject



12
13
14
15
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 12

def new
  @asset = Kuhsaft::Asset.new
  respond_with @asset
end

#updateObject



28
29
30
31
32
# File 'app/controllers/kuhsaft/admin/assets_controller.rb', line 28

def update
  @asset = Kuhsaft::Asset.find(params[:id])
  @asset.update_attributes(params[:kuhsaft_asset])
  respond_with @asset, :location => admin_assets_path
end