Skip to content

Instantly share code, notes, and snippets.

@foxweb
Created July 4, 2014 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxweb/c0507a0020e6089376ce to your computer and use it in GitHub Desktop.
Save foxweb/c0507a0020e6089376ce to your computer and use it in GitHub Desktop.
types = %w(people companies places events type1 type2 type3 type4 type5 type6)
positions =* (1..10)
Document.all.each do |document|
puts 'Document GID: ' + document.gid.to_s
positions.each do |position|
tagging = Tagging.create do |tagging|
tagging.document_gid = document.gid
tagging.type = types.sample
tagging.zone_id = document.zone_id
tagging.position = position
end
puts ' Tagging: ' + tagging.id.to_s
end
end
@7even
Copy link

7even commented Jul 7, 2014

Ну можно было бы и создание документов описать:

100_000.times do |i|
  quietly do
    Document.create(title: "doc#{i}", zone_id: 1)
  end

  puts "created doc#{i}"
end

@foxweb
Copy link
Author

foxweb commented Jul 7, 2014

В populate.rake сделал такое.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment