Sha256: 54ebcb4b4b2385a9cbe55fcb35ba36e464dfade58d01bf2ac39b9ec8198ccac1

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

class ShopDiscountablesDataset < Dataset::Base  
  
  uses :shop_discounts, :shop_products, :shop_categories
  
  def load
    create_record :shop_discountables, :ten_percent_bread,
      :discount_id    => shop_discounts(:ten_percent).id,
      :discounted_id  => shop_categories(:bread).id,
      :discounted_type => 'ShopCategory'

    create_record :shop_discountables, :five_percent_bread,
      :discount_id    => shop_discounts(:five_percent).id,
      :discounted_id  => shop_categories(:bread).id,
      :discounted_type => 'ShopCategory'

    create_record :shop_discountables, :five_percent_crusty_bread,
      :discount_id    => shop_discounts(:five_percent).id,
      :discounted_id  => shop_products(:crusty_bread).id,
      :discounted_type => 'ShopProduct'
  end
    
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-shop_discounts-extension-0.0.3 spec/datasets/shop_discountables.rb
radiant-shop_discounts-extension-0.0.1 spec/datasets/shop_discountables.rb