Class: Admin::BannerSetsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/admin/banner_sets_controller.rb', line 23

def create
  @banner_set = SpudBannerSet.new(banner_set_params)
  if @banner_set.save
    flash.now[:notice] = 'BannerSet created successfully' 
    render 'create'
  else
    render 'new', :status => 422
  end
end

#destroyObject



46
47
48
49
50
51
# File 'app/controllers/admin/banner_sets_controller.rb', line 46

def destroy
  if @banner_set.destroy
    flash.now[:notice] = 'BannerSet deleted successfully' 
  end
  render :nothing => true
end

#editObject



33
34
35
# File 'app/controllers/admin/banner_sets_controller.rb', line 33

def edit
  respond_with @banner_set
end

#indexObject



9
10
11
12
# File 'app/controllers/admin/banner_sets_controller.rb', line 9

def index
  @banner_sets = SpudBannerSet.all
  respond_with @banner_sets, :layout => 'admin/detail'
end

#newObject



18
19
20
21
# File 'app/controllers/admin/banner_sets_controller.rb', line 18

def new
  @banner_set = SpudBannerSet.new
  respond_with @banner_set
end

#showObject



14
15
16
# File 'app/controllers/admin/banner_sets_controller.rb', line 14

def show
  respond_with @banner_set, :layout => 'admin/detail'
end

#updateObject



37
38
39
40
41
42
43
44
# File 'app/controllers/admin/banner_sets_controller.rb', line 37

def update
  if @banner_set.update_attributes(banner_set_params)
    flash.now[:notice] = 'BannerSet updated successfully'
    render 'create'
  else
    render 'edit', :status => 422
  end
end