Class: SimpleFormAttachments::UploadController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/simple_form_attachments/upload_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


10
11
12
13
14
# File 'app/controllers/simple_form_attachments/upload_controller.rb', line 10

def create
  @attachment = new_attachment
  res = @attachment.save
  render json: { html: attachment_html(@attachment) }, status: (res ? :ok : :unprocessable_entity)
end

#showObject


5
6
7
8
# File 'app/controllers/simple_form_attachments/upload_controller.rb', line 5

def show
  @attachment = attachment_class.find(params[:id])
  render json: { html: attachment_html(@attachment) }, status: :ok
end