Sha256: cc9727d6907682baf96183299717d32e675e07e9b678c08900787822e531eeb2

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

class AttachmentsController <  ApplicationController
  before_filter :authenticate_user!

  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

3 entries across 3 versions & 1 rubygems

Version Path
tawork-0.0.48 app/controllers/attachments_controller.rb
tawork-0.0.47 app/controllers/attachments_controller.rb
tawork-0.0.46 app/controllers/attachments_controller.rb