Class: Admin::Carousel::CarouselsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/carousel/carousels_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/admin/carousel/carousels_controller.rb', line 18

def create
  @carousel.save!
  flash[:notice] = 'Carousel created'
  redirect_to new_admin_carousel_carousel_slide_path(@carousel)

rescue ActiveRecord::RecordInvalid
  flash.now[:error] = 'Failed to create Carousel'
  render :action => :new
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/admin/carousel/carousels_controller.rb', line 38

def destroy
  @carousel.destroy
  flash[:notice] = 'Carousel removed'
  redirect_to :action => :index
end

#editObject



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

def edit
  render
end

#indexObject



6
7
8
# File 'app/controllers/admin/carousel/carousels_controller.rb', line 6

def index
  @carousels = Carousel::Carousel.all
end

#newObject



10
11
12
# File 'app/controllers/admin/carousel/carousels_controller.rb', line 10

def new
  render
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/admin/carousel/carousels_controller.rb', line 28

def update
  @carousel.update_attributes!(params[:carousel])
  flash[:notice] = 'Carousel updated'
  redirect_to :action => :edit, :id => @carousel
  
rescue ActiveRecord::RecordInvalid
  flash.now[:error] = 'Failed to update Carousel'
  render :action => :edit
end