Sha256: b4f4e6ec948e0626da5ab88abefa6a9f1432616d9808b32868e42fab9d423bff

Contents?: true

Size: 630 Bytes

Versions: 11

Compression:

Stored size: 630 Bytes

Contents

Category.delete_all
Post.delete_all


category_names = [
  'Books',
  'Code',
  'Design',
  'Database',
  'Education',
  'Personal',
  'News',
  'Stuff',
  'Others'
]

categories = category_names.map do |name|
  Category.create! name: name
end

400.times do |i|
  Post.create!(
    category:       categories.sample,
    title:          "Example post #{i + 1}",
    body:           'Body text',
    views_count:    rand(1000),
    likes_count:    rand(1000),
    comments_count: rand(1000),
    published_at:   [rand(30).days.ago, rand(30).days.from_now].sample,
    created_at:     rand(30).days.ago
  )
  print '.'
end

puts ''

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
search_object_graphql-1.0.5 example/db/seeds.rb
search_object_graphql-1.0.4 example/db/seeds.rb
search_object_graphql-1.0.3 example/db/seeds.rb
search_object_graphql-1.0.2 example/db/seeds.rb
search_object_graphql-1.0.1 example/db/seeds.rb
search_object_graphql-1.0.0 example/db/seeds.rb
search_object_graphql-0.3.2 example/db/seeds.rb
search_object_graphql-0.3.1 example/db/seeds.rb
search_object_graphql-0.3 example/db/seeds.rb
search_object_graphql-0.2 example/db/seeds.rb
search_object_graphql-0.1 example/db/seeds.rb