Class: CarrierwaveGallery::Admin::ImagesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/carrierwave_gallery/admin/images_controller.rb', line 7

def create
  @gallery = Gallery.find(params[:gallery_id])

  @image = @gallery.images.create(:file => params[:file])

  if @image.save!
    respond_to do |format|
      format.json { render :json => @image }
    end
  end
end

#destroyObject



23
24
25
26
27
# File 'app/controllers/carrierwave_gallery/admin/images_controller.rb', line 23

def destroy
  destroy! {
    render :nothing => true and return
  }
end

#updateObject



19
20
21
# File 'app/controllers/carrierwave_gallery/admin/images_controller.rb', line 19

def update
  update!{ admin_gallery_path(@gallery) }
end