Sha256: 0defdebf8b3c03881ea42872f045b0855752e565f7db175f13454a6f1c8d950d

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

module Kms
  class ProductDrop < Liquor::Drop
    include Kms::Catalog::Engine.routes.url_helpers
    attributes :name, :description, :price, :permalink
    has_many :children
    has_many :categories
    has_one :master
    has_many :variants
    # has_many :properties

    export :image_url
    export :properties
    scopes :order

    def image_url
      source.master.image.url
    end

    def price
      source.master.price.to_s
    end

    def properties
      props = []
      source.properties.group_by(&:tag).each do |key, value|
        props << [key, value.map { |val| [val.name, val.value] }]
      end
      props
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kms_catalog-0.5.0 lib/drops/kms/product_drop.rb