Sha256: b79343f5377f11f90a09325a1ceb3bafaf24535c63d2066e339285f9867848d1
Contents?: true
Size: 992 Bytes
Versions: 4
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true module PagesCore module AttachmentsHelper def attachment_path(*args) super(*attachment_params(args)) end def download_attachment_path(*args) super(*attachment_params(args)) end def page_file_path(*args) ActiveSupport::Deprecation.warn( "#page_file_path is deprecated, use #attachment_path" ) page_file = args.detect { |a| a.is_a?(PageFile) } return attachment_path(page_file.attachment) if page_file super end private def attachment_params(args) attachment = args.detect { |a| a.is_a?(Attachment) } args = [attachment.digest] + args if args.first == attachment if args.last.is_a?(Hash) args.last[:format] = attachment.filename_extension else args.push(format: attachment.filename_extension) end args end def attachment_digest(attachment) Attachment.verifier.generate(attachment.id.to_s) end end end
Version data entries
4 entries across 4 versions & 1 rubygems