Y = YAML
A = Ain’t
M = Markup
L = Language

YAML is a data serialisation standard for all programming languages.

You can see the commits: migraine-app/commit

How can it work?

You need to require "yaml"

I need this data to define my default types that I will have in my app, so I need to define this:

DEFAULT_TYPES = YAML.load_file("./config/default_types.yml")

I create a file with the extension .yml
Then I write all the categories and names that I want to appearing on the user

- category: "Food"
  name: "Chesse"
- category: "Food"
  name: "Chocolate"
- category: "Food"
  name: "Skip dinner"
- category: "Drink"
  name: "Cofee"
- category: "Drink"
  name: "Soda"
- category: "Drink"
  name: "Acoholic beverages"
- category: "Symptoms"
  name: "Nausea or vomiting"
- category: "Symptoms"
  name: "Sensitive to light, noise, smell"
- category: "Body Changes"
  name: "Mentruation or Skip menstruation"
- category: "Body Changes"
  name: "Stress"
- category: "Medication"
  name: "Ergotamin"
- category: "Medication"
  name: "Exedrin"
- category: "Medication"
  name: "Aspirin"
DEFAULT_TYPES.each do |type_attributes|
  Type.create(category: type_attributes["category"],
                  name: type_attributes["name"],
               user_id: user.id)
end

Now I erase all the list of names and categories because I need to write in the app the list by default (.ymL file)

Once we place this code, all the users has default types in the profile.