Class: S3Relay::UploadsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/s3_relay/uploads_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/s3_relay/uploads_controller.rb', line 10

def create
  @upload = S3Relay::Upload.new(upload_attrs)

  if @upload.save
    render json: { private_url: @upload.private_url }, status: 201
  else
    render json: { errors: @upload.errors }, status: 422
  end
end

#newObject



6
7
8
# File 'app/controllers/s3_relay/uploads_controller.rb', line 6

def new
  render json: S3Relay::UploadPresigner.new.form_data
end