Sha256: 0f85b3bf357d97fe962837dbc7be1aae4e5fb38cd1db44d4d7a546a25a41e1e3
Contents?: true
Size: 683 Bytes
Versions: 2
Compression:
Stored size: 683 Bytes
Contents
module Workarea module Storefront class VariantViewModel < ApplicationViewModel delegate :inventory_status, :images, :primary_image, :inventory, :inventory_purchasable?, :pricing, to: :product def product @product ||= ProductViewModel.wrap(model.product, options.merge(sku: sku)) end def details @details ||= Hash[ model.details.map { |k, v| [k.to_s.optionize, [v].flatten.join(', ')] } ] end def price @price ||= pricing.for_sku(sku) end def purchasable? product.model.purchasable? && inventory_purchasable? && price.persisted? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-variant_list-1.0.3 | app/view_models/workarea/storefront/variant_view_model.rb |
workarea-variant_list-1.0.2 | app/view_models/workarea/storefront/variant_view_model.rb |