Sha256: 0a19b109b1e3552d5c212aa600ece7b6fce2f308d7396cbc8cfdd03a83256bce

Contents?: true

Size: 1.18 KB

Versions: 23

Compression:

Stored size: 1.18 KB

Contents

class ShopAttachmentsDataset < Dataset::Base
  
  uses :shop_products
  
  def load
    category_images = [ :bread, :milk, :salad ]
    product_images  = [ :soft_bread_front, :soft_bread_back, :soft_bread_top, :crusty_bread_front, :warm_bread_front ]
    
    product_images.each_with_index do |image, i|
      create_record :image, image, 
        :title              => image.to_s,
        :asset_file_name    => "#{image.to_s}_file_name.png",
        :asset_content_type => "image/png",
        :asset_file_size    => i+1*1000
        
      create_record :attachment, image,
        :image    => images(image.to_sym),
        :page     => shop_products(image.to_s.split('_')[0,2].join('_').to_sym).page,
        :position => i + 1
    end
    
    category_images.each_with_index do |image, i|
      create_record :image, image, 
        :title              => image.to_s,
        :asset_file_name    => "#{image.to_s}_file_name.png",
        :asset_content_type => "image/png",
        :asset_file_size    => i+1*1000
        
      create_record :attachment, image,
        :image    => images(image.to_sym),
        :page     => shop_categories(image).page,
        :position => i + 1
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
radiant-shop-extension-0.94.8 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.7 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.6 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.5 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.4 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.3 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.2 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.1 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.94.0 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.93.3 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.93.2 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.93.1 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.93.0 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.11 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.10 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.9 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.8 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.7 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.6 spec/datasets/shop_attachments.rb
radiant-shop-extension-0.92.3 spec/datasets/shop_attachments.rb