Class: ImagesController

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) create



16
17
18
19
20
21
22
# File 'app/controllers/images_controller.rb', line 16

def create
  if @image.save
    render json: @image, status: :created, location: project_image_url(@project, @image)
  else
    render json: { errors: @image.errors }, status: :unprocessable_entity
  end
end

- (Object) destroy



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

def destroy
  @image.destroy
  head :no_content
end

- (Object) index



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

def index
  render json: json_defaults(@images), status: :ok
end

- (Object) show



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

def show
  render json: json_defaults(@image), status: :ok
end