Sha256: 9e6d344826c1ba1e3cfcc8b35bced552632b7dea8b8b5ba1eb00b80de5083e89
Contents?: true
Size: 773 Bytes
Versions: 34
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
34 entries across 34 versions & 1 rubygems