Sha256: 01245f558011fa582d2261a7b95dbe0a83a1593e8757182ab57ac09c0655b870
Contents?: true
Size: 745 Bytes
Versions: 3
Compression:
Stored size: 745 Bytes
Contents
Comable::Sample.import('categories') clothing = Comable::Category.where(name: Comable::Sample.t(:clothing)).first! products_attributes = [ { name: Comable::Sample.t(:suede_dress), price: 6_990, categories: [clothing] }, { name: Comable::Sample.t(:girly_coat), price: 9_000, categories: [clothing] }, { name: Comable::Sample.t(:fur_gloves), price: 5_292, categories: [clothing] }, { name: Comable::Sample.t(:leather_boots), price: 28_080, categories: [clothing] } ] next_id = (Comable::Product.maximum(:id) || 0).next products_attributes.each.with_index(next_id) do |attributes, index| code = format('%05d', index) Comable::Product.create!(attributes.merge(code: code)) end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
comable-sample-0.6.0 | db/samples/products.rb |
comable_sample-0.5.0 | db/samples/products.rb |
comable_sample-0.4.2 | db/samples/products.rb |