Sha256: 04b3b306ee2ff70b8e323fe7f24e0a4c53aa29321cde0a2d8c884465e210abdc

Contents?: true

Size: 939 Bytes

Versions: 6

Compression:

Stored size: 939 Bytes

Contents

class ShopCategoriesDataset < Dataset::Base
  
  uses :shop_variants, :pages
  
  def load
    categories = [:bread, :milk, :salad]
    
    create_record :layout, :category,
      :name => 'category'
    
    create_record :layout, :product,
      :name => 'product'
      
    categories.each_with_index do |category, i|      
      create_record :page, category,
        :title      => category.to_s,
        :slug       => category.to_s,
        :breadcrumb => category.to_s,
        :parent     => Page.first,
        :class_name => 'ShopCategoryPage',
        :layout     => layouts(:category)
        
      create_record :shop_category, category,
        :product_layout => layouts(:product),
        :page       => pages(category).id
        
      create_record :page_part, category,
        :name       => 'description',
        :content    => "*#{category.to_s}*",
        :page       => pages(category)
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-shop-extension-0.11.6 spec/datasets/shop_categories.rb
radiant-shop-extension-0.11.5 spec/datasets/shop_categories.rb
radiant-shop-extension-0.11.4 spec/datasets/shop_categories.rb
radiant-shop-extension-0.11.3 spec/datasets/shop_categories.rb
radiant-shop-extension-0.11.1 spec/datasets/shop_categories.rb
radiant-shop-extension-0.11.0 spec/datasets/shop_categories.rb