Skip to content

Instantly share code, notes, and snippets.

@verkligheten
Created December 3, 2015 13:55
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 verkligheten/7b7d662a98572fec8512 to your computer and use it in GitHub Desktop.
Save verkligheten/7b7d662a98572fec8512 to your computer and use it in GitHub Desktop.
seed
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
users = User.create([{"email" => "user1@email.com", "password" => "12345678", "password_confirmation" => "12345678"}, {"email" => "user2@email.com", "password" => "12345678", "password_confirmation" => "12345678"}])
DietaryPreference.create([{name: "I`ll eat it all!", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
{name: "Vegetarian", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
{name: "Dairy Free", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
{name: "I have specific nutritional goals", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
{name: "Vegan", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},
{name: "Gluten Free", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))}])
DietaryGoal.create([{name: "High protein", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
{name: "Low carb", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
{name: "Low calories", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
{name: "Low fat", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
{name: "Low sugar", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))},
{name: "Macro based", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'goal.jpg'))}])
Ingredient.create([{name: "Wild rice"},
{name: "Cucumber"},
{name: "Egg"},
{name: "Meat"},
{name: "Milk"},
{name: "Tomato"}])
IngredientCategory.create([{name: "Bases"},
{name: "Protein"},
{name: "Vegetables"},
{name: "Fruits"},
{name: "Cheeses"},
{name: "Nuts & Seeds"},
{name: "Crunch"},
{name: "Dressings"}])
20.times do |i|
HelpBlock.create([{key: "Help Block #{i+1}", description: "Description for Help Block #{i+1}"}])
end
20.times do |i|
MealExample.create([{user_name: "UserName#{i}",
user_avatar: File.open(Rails.root.join('test', 'fixtures', 'files', 'avatar1.png')),
meal_photo: File.open(Rails.root.join('test', 'fixtures', 'files', 'intro_screen_block_salad.png')),
meal_ingredients: "Chiken#{i}, Salad#{i}, Tomatos#{i}",
user_goals: [DietaryGoal.first.name, DietaryGoal.last.name]}])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment