Sha256: 949da54afd15f804d5efd949d6aab58d1b3b972d4e3e32860a560dd952294806
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
module Workarea class ProductReleases attr_reader :product def initialize(product) @product = product end def releases changesets .uniq(&:release) .reject { |cs| cs.release.blank? } .flat_map { |cs| [cs.release] + cs.release.scheduled_after } .uniq end # All {Releasable}s that could affect the product's Elasticsearch document # should add their changesets to this method. # # @example Add to the changesets affecting a product in a decorator # def changesets # super.merge(SomeReleasable.for_product(product.id).changesets_with_children) # end # # @return [Mongoid::Criteria] # def changesets criteria = product.changesets_with_children pricing_skus.each { |ps| criteria.merge!(ps.changesets_with_children) } criteria.merge!(FeaturedProducts.changesets(product.id)) criteria.includes(:release) end def pricing_skus Pricing::Sku.in(id: product.skus).to_a end end end
Version data entries
14 entries across 14 versions & 1 rubygems