Sha256: 5854b2a7e40a7dc733f86761816c8f0c30a8207323225693456989af77e1e899
Contents?: true
Size: 948 Bytes
Versions: 25
Compression:
Stored size: 948 Bytes
Contents
module Spree module Api module V2 module StoreMediaSerializerImagesConcern extend ActiveSupport::Concern included do def self.store_image_url_for(store, attribute_name) attachment = store.send(attribute_name)&.attachment return unless attachment&.attached? url_helpers = Rails.application.routes.url_helpers if Spree.public_storage_service_name url_helpers.cdn_image_url(attachment) else url_helpers.rails_blob_path(attachment) end end attribute :logo do |store| store_image_url_for store, :logo end attribute :mailer_logo do |store| store_image_url_for store, :mailer_logo end attribute :favicon_path do |store| store_image_url_for store, :favicon_image end end end end end end
Version data entries
25 entries across 25 versions & 3 rubygems