Sha256: e268ab36babb383446d066a29940753bfa25a8baaa09878660746e1f79cd73a6

Contents?: true

Size: 440 Bytes

Versions: 5

Compression:

Stored size: 440 Bytes

Contents

module Workarea
  module Search
    class Storefront
      class ProductOptionImageUrl < Workarea::ProductPrimaryImageUrl
        def initialize(product, image_size: :small_thumb, option:)
          super(product, image_size)
          @option = option
        end

        def image
          @product.images.find_by(option: @option)
        rescue Mongoid::Errors::DocumentNotFound
          super
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-browse_option-2.2.0 app/models/workarea/search/storefront/product_option_image_url.rb
workarea-browse_option-2.1.9 app/models/workarea/search/storefront/product_option_image_url.rb
workarea-browse_option-2.1.8 app/models/workarea/search/storefront/product_option_image_url.rb
workarea-browse_option-2.1.7 app/models/workarea/search/storefront/product_option_image_url.rb
workarea-browse_option-2.1.6 app/models/workarea/search/storefront/product_option_image_url.rb