public
Created

  • Download Gist
populate.rake
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
filters = populate(Filter, 4) do |filter|
filter.title = words
filter.service = services.rand
(2+rand(3)).times do
filter.options << FilterOption.new(:filter => filter, :value => words)
end
end
display_amount(FilterOption)
 
 
company_services = populate(CompanyService, 3) do |company_service|
company_service.company = companies.rand
company_service.service = services.rand
rand(3).times do
company_service.prices.build(
:company_service => company_service,
:title => sentence,
:value => rand_price,
:valid_from => (rand(10) + 1).days.ago,
:valid_until => DateTime.now + rand(20).days
)
end
company_service.service.filters.each do |filter|
company_service.filter_options << filter.options.rand
company_service.save!
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.