Sha256: 02c433333d378e179c5559c76bb235a69ff81328f7bc8f4508604fd56d3ea790
Contents?: true
Size: 773 Bytes
Versions: 9
Compression:
Stored size: 773 Bytes
Contents
require_dependency 'avo/application_controller' module Avo class AttachmentsController < ApplicationController before_action :set_resource_name, only: :destroy before_action :set_resource, only: :destroy before_action :set_model, only: :destroy def show end def destroy blob = ActiveStorage::Blob.find(params[:signed_attachment_id]) attachment = blob.attachments.find_by record_id: params[:id], record_type: @model.class.to_s if attachment.present? attachment.destroy redirect_to params[:referrer] || resource_path(@model), notice: t('avo.attachment_destroyed') else redirect_back fallback_location: resource_path(@model), notice: t('avo.failed_to_find_attachment') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems