Class: Admin::ImagesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user!, #current_user, #load_settings

Instance Method Details

#createObject


19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/admin/images_controller.rb', line 19

def create
  @image = current_user.images.build(image_params)

  if @image.save
    redirect_to admin_images_path, notice: 'Image uploaded!'
  else
    flash.now.alert = 'Error uploading image.'
    render :new
  end
end

#indexObject


8
9
10
# File 'app/controllers/admin/images_controller.rb', line 8

def index
  @images = Image.all
end

#newObject


15
16
17
# File 'app/controllers/admin/images_controller.rb', line 15

def new
  @image = current_user.images.build
end

#showObject


12
13
# File 'app/controllers/admin/images_controller.rb', line 12

def show
end