Class: CarrierwaveGallery::Admin::GalleryController

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

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 15

def create
  @gallery = Gallery.new(gallery_params)

  respond_to do |format|
    if @gallery.save
      format.html { redirect_to admin_gallery_path(@gallery), notice: 'Gallery was successfully created.' }
      format.json { render :show, status: :created, location: @gallery }
    else
      format.html { render :new }
      format.json { render json: @gallery.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject



44
45
46
47
48
49
50
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 44

def destroy
  @gallery.destroy
  respond_to do |format|
    format.html { redirect_to admin_gallery_index_path, notice: 'Gallery was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject



29
30
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 29

def edit
end

#indexObject



4
5
6
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 4

def index
  @collection = Gallery.all
end

#newObject



11
12
13
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 11

def new
  @gallery = Gallery.new
end

#showObject



8
9
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 8

def show
end

#updateObject



32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/carrierwave_gallery/admin/gallery_controller.rb', line 32

def update
  respond_to do |format|
    if @gallery.update(gallery_params)
      format.html { redirect_to admin_gallery_path(@gallery), notice: 'Gallery was successfully updated.' }
      format.json { render :show, status: :ok, location: @gallery }
    else
      format.html { render :edit }
      format.json { render json: @gallery.errors, status: :unprocessable_entity }
    end
  end
end