Class: Admin::ImagesController

Inherits:
ApplicationController show all
Defined in:
lib/ecrire/app/controllers/admin/images_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#posts

Methods inherited from ApplicationController

#current_user, #signed_in?, #url

Instance Method Details

#createObject



10
11
12
13
14
15
16
# File 'lib/ecrire/app/controllers/admin/images_controller.rb', line 10

def create
  @image = post.header || post.build_header

  unless @image.update(image_params)
    render 'errors', status: 500
  end
end

#destroyObject



18
19
20
21
# File 'lib/ecrire/app/controllers/admin/images_controller.rb', line 18

def destroy
  @image = post.header
  @image.clear!
end

#indexObject



3
4
5
6
7
8
# File 'lib/ecrire/app/controllers/admin/images_controller.rb', line 3

def index
  @images = post.images
  respond_to do |format|
    format.js
  end
end