Skip to content

Instantly share code, notes, and snippets.

@jgagne33
Created August 27, 2009 23:18
Show Gist options
  • Save jgagne33/176652 to your computer and use it in GitHub Desktop.
Save jgagne33/176652 to your computer and use it in GitHub Desktop.
Hotel.populate 2..5 do |hostel|
hotel.city_id = city.id
hotel.name = Populator.words(1..2) + " hotel"
hotel.phone = Faker::PhoneNumber.phone_number
hotel.address = Faker::Address.street_address
Event.populate 4...8 do |event|
event.date_and_time = 3.days.from_now...10.months.from_now
event.title = Populator.words(2..5).titleize
ActiveRecord::Base.connection.execute("INSERT INTO events_hotels (event_id,
hotel_id) VALUES (#{event.id}, #{hotel.id})")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment