Sha256: b60b8f9c60b77c6340a6253d5b5c98ef905b812b5e6c7c2f5608999efd73cf29
Contents?: true
Size: 684 Bytes
Versions: 6
Compression:
Stored size: 684 Bytes
Contents
require 'bundler/setup' require 'groovy' Groovy.open('./db/products') class Product include Groovy::Model schema do |t| t.string :name t.integer :price t.boolean :published t.timestamps end scope :by_price, -> { puts self.inspect; sort_by(price: :asc) } scope :named, -> (name) { puts self.inspect; where(name: name) if name } end def populate 5_000.times do |i| puts "Creating product #{i}" if i % 1000 == 0 Product.create!(name: "A product with index #{i}", published: true, price: 10000 + i % 10) end end populate if Product.count == 0 # 50_000 products: 50M # 100_000 products: 50M # 500_000 products: 62M
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
groovy-0.4.6 | example/basic.rb |
groovy-0.4.5 | example/basic.rb |
groovy-0.4.4 | example/basic.rb |
groovy-0.4.3 | example/basic.rb |
groovy-0.4.2 | example/basic.rb |
groovy-0.4.1 | example/basic.rb |