Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def make_attractions_and_rides
  2. DATA[:attractions].each do |attraction|
  3. new_attraction = Attraction.new
  4. attraction.each_with_index do |attribute, i|
  5. new_attraction.send(DATA[:attraction_keys][i] + "=", attribute)
  6. end
  7. rand(1..8).times do
  8. customers = []
  9. User.all.each {|u| customers << u if u.admin != true}
  10. new_attraction.users << customers[rand(0...customers.length)]
  11. end
  12. new_attraction.users.each {|c| c.save}
  13. new_attraction.save
  14. end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement