Sha256: 7f8911e0e4618baed42cb6454a8bc9a23ccbebc52c26c3141ee91c85cc119caf

Contents?: true

Size: 510 Bytes

Versions: 20

Compression:

Stored size: 510 Bytes

Contents

class AttachmentsController <  ApplicationController
  def show
    attachment = Attachment.find params[:id]

    send_data attachment.file_data,
      type:         attachment.content_type,
      filename:     attachment.filename,
      disposition:  'inline'
  end

  def upload
    @attachment = Attachment.find params[:id]
    @attachment.update(params[:file], current_user)
  end

  def destroy
    @attachment = Attachment.find params[:id]
    @attachment.save_and_destroy

    render json: {}
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
tawork-0.0.45 app/controllers/attachments_controller.rb
tawork-0.0.44 app/controllers/attachments_controller.rb
tawork-0.0.43 app/controllers/attachments_controller.rb
tawork-0.0.42 app/controllers/attachments_controller.rb
tawork-0.0.41 app/controllers/attachments_controller.rb
tawork-0.0.40 app/controllers/attachments_controller.rb
tawork-0.0.39 app/controllers/attachments_controller.rb
tawork-0.0.38 app/controllers/attachments_controller.rb
tawork-0.0.37 app/controllers/attachments_controller.rb
tawork-0.0.36 app/controllers/attachments_controller.rb
tawork-0.0.35 app/controllers/attachments_controller.rb
tawork-0.0.34 app/controllers/attachments_controller.rb
tawork-0.0.33 app/controllers/attachments_controller.rb
tawork-0.0.31 app/controllers/attachments_controller.rb
tawork-0.0.30 app/controllers/attachments_controller.rb
tawork-0.0.29 app/controllers/attachments_controller.rb
tawork-0.0.28 app/controllers/attachments_controller.rb
tawork-0.0.27 app/controllers/attachments_controller.rb
tawork-0.0.26 app/controllers/attachments_controller.rb
tawork-0.0.25 app/controllers/attachments_controller.rb