Sha256: a1c22521cd53276e296d6888c79ebb0f0ad366f94d369c2b3c279befd9183dcb
Contents?: true
Size: 948 Bytes
Versions: 10
Compression:
Stored size: 948 Bytes
Contents
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) categories = { 'Category #1' => { 'Category #11' => {}, 'Category #12' => { 'Category #121' => { 'Category #1211' => {} }, 'Category #122' =>{} }, 'Category #13' => { 'Category #131' => {} } }, 'Category #2' => { 'Category #21' => {} } } def create_category hash, parent = nil hash.each do |(title, children)| c = Category.create :title => title, :parent => parent create_category children, c end end create_category categories 40.times do |i| User.create! :email => "email#{i}@gmail.com", :password => '1'*(rand(7)+6) end
Version data entries
10 entries across 10 versions & 1 rubygems