Module: Voltron::Upload::ControllerMethods

Defined in:
lib/voltron/upload.rb

Instance Method Summary collapse

Instance Method Details

#uploadObject



30
31
32
33
34
35
36
# File 'lib/voltron/upload.rb', line 30

def upload
  begin
    render json: uploader.process!(upload_params), status: :created
  rescue Voltron::Upload::Error => e
    render json: e.response, status: e.status
  end
end

#upload_paramsObject



42
43
44
# File 'lib/voltron/upload.rb', line 42

def upload_params
  request.parameters[uploader.resource_name].slice(*uploader.permitted_params)
end

#uploaderObject



38
39
40
# File 'lib/voltron/upload.rb', line 38

def uploader
  self.class.instance_variable_get('@uploader')
end