Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created August 28, 2010 17:33
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 bogdan/555375 to your computer and use it in GitHub Desktop.
Save bogdan/555375 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment