class AttachmentsController < ApplicationController
  skip_after_action :verify_authorized, only: [:new]

  def show
    attachment = Attachment.find(params[:id])
    authorize attachment, :show?
    send_file attachment.file.path, disposition: :inline
  end

  def new
    @index = params[:index].to_i
    @doc = Doc.new
    @doc.attachments.build
    render layout: false
  end
end
