Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. # This file should contain all the record creation needed to seed the database with its default values.
  2. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  3. #
  4. # Examples:
  5. #
  6. # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
  7. # Mayor.create(name: 'Emanuel', city: cities.first)
  8.  
  9. users = User.create([{"email" => "user1@email.com", "password" => "12345678", "password_confirmation" => "12345678"}, {"email" => "user2@email.com", "password" => "12345678", "password_confirmation" => "12345678"}])
  10. DietaryPreference.create([{name: "I`ll eat it all!", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
  11. {name: "Vegetarian", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
  12. {name: "Dairy Free", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
  13. {name: "I have specific nutritional goals", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
  14. {name: "Vegan", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
  15. {name: "Gluten Free", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))}])
  16.  
  17. DietaryGoal.create([{name: "High protein", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
  18. {name: "Low carb", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
  19. {name: "Low calories", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
  20. {name: "Low fat", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
  21. {name: "Low sugar", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
  22. {name: "Macro based", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))}])
  23.  
  24. Ingredient.create([{name: "Wild rice"},
  25. {name: "Cucumber"},
  26. {name: "Egg"},
  27. {name: "Meat"},
  28. {name: "Milk"},
  29. {name: "Tomato"}])
  30.  
  31. IngredientCategory.create([{name: "Bases"},
  32. {name: "Protein"},
  33. {name: "Vegetables"},
  34. {name: "Fruits"},
  35. {name: "Cheeses"},
  36. {name: "Nuts & Seeds"},
  37. {name: "Crunch"},
  38. {name: "Dressings"}])
  39.  
  40. 20.times do |i|
  41. HelpBlock.create([{key: "Help Block #{i+1}", description: "Description for Help Block #{i+1}"}])
  42. end
  43.  
  44. 20.times do |i|
  45. MealExample.create([{user_name: "UserName#{i}",
  46. user_avatar: File.open(Rails.root.join('test', 'fixtures', 'files', 'avatar1.png')),
  47. meal_photo: File.open(Rails.root.join('test', 'fixtures', 'files', 'intro_screen_block_salad.png')),
  48. meal_ingredients: "Chiken#{i}, Salad#{i}, Tomatos#{i}",
  49. user_goals: [DietaryGoal.first.name, DietaryGoal.last.name]}])
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement