{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/212","repository_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/212/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/212/events","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/212","id":151660831,"number":212,"title":"Trying to add reference to foods in meal_items","user":{"login":"louarnos","id":17519351,"avatar_url":"https://avatars.githubusercontent.com/u/17519351?v=3","gravatar_id":"","url":"https://api.github.com/users/louarnos","html_url":"https://github.com/louarnos","followers_url":"https://api.github.com/users/louarnos/followers","following_url":"https://api.github.com/users/louarnos/following{/other_user}","gists_url":"https://api.github.com/users/louarnos/gists{/gist_id}","starred_url":"https://api.github.com/users/louarnos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louarnos/subscriptions","organizations_url":"https://api.github.com/users/louarnos/orgs","repos_url":"https://api.github.com/users/louarnos/repos","events_url":"https://api.github.com/users/louarnos/events{/privacy}","received_events_url":"https://api.github.com/users/louarnos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-28T14:45:03Z","updated_at":"2016-04-28T14:55:06Z","closed_at":null,"body":"I have a join table called meal_item that is supposed to reference both food and meal... I created migrations for food, meal, and meal_item... I then tried to create references in meal_item to both the others. When I rake db:migrate I dont get a failure but when I enter rails db and look at the columns in meal_item I see:\r\n\r\n``` bash\r\nfood-tracker_development=# \\d meal_items\r\n                                      Table \"public.meal_items\"\r\n    Column    |            Type             |                        Modifiers                        \r\n--------------+-----------------------------+---------------------------------------------------------\r\n id           | integer                     | not null default nextval('meal_items_id_seq'::regclass)\r\n serv_qty     | integer                     | \r\n created_at   | timestamp without time zone | not null\r\n updated_at   | timestamp without time zone | not null\r\n user_meal_id | integer                     | \r\nIndexes:\r\n    \"meal_items_pkey\" PRIMARY KEY, btree (id)\r\n    \"index_meal_items_on_user_meal_id\" btree (user_meal_id)\r\nForeign-key constraints:\r\n    \"fk_rails_c04a4407b1\" FOREIGN KEY (user_meal_id) REFERENCES meals(id)\r\n\r\n```\r\n\r\nHere is the code for my reference migrations:\r\n``` bash\r\nclass CreateAddMealsToMealItems < ActiveRecord::Migration\r\n  def change\r\n    create_table :add_meals_to_meal_items do |t|\r\n\r\n      t.timestamps null: false\r\n      add_reference :meal_items, :user_meal, references: :meals, index: true\r\n      add_foreign_key :meal_items, :meals, column: :user_meal_id\r\n    end\r\n  end\r\nend\r\n```\r\n``` bash\r\nclass CreateAddfoodtoMealItems < ActiveRecord::Migration\r\n  def change\r\n    create_table :add_food_to_meal_items do |t|\r\n\r\n      t.timestamps null: false\r\n      add_reference :meal_items, :food_for_meal, references: :foods, index: true\r\n      add_foreign_key :meal_items, :foods, column: :food_for_meal_id\r\n    end\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/comments/215452432","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/212#issuecomment-215452432","issue_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/212","id":215452432,"user":{"login":"louarnos","id":17519351,"avatar_url":"https://avatars.githubusercontent.com/u/17519351?v=3","gravatar_id":"","url":"https://api.github.com/users/louarnos","html_url":"https://github.com/louarnos","followers_url":"https://api.github.com/users/louarnos/followers","following_url":"https://api.github.com/users/louarnos/following{/other_user}","gists_url":"https://api.github.com/users/louarnos/gists{/gist_id}","starred_url":"https://api.github.com/users/louarnos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louarnos/subscriptions","organizations_url":"https://api.github.com/users/louarnos/orgs","repos_url":"https://api.github.com/users/louarnos/repos","events_url":"https://api.github.com/users/louarnos/events{/privacy}","received_events_url":"https://api.github.com/users/louarnos/received_events","type":"User","site_admin":false},"created_at":"2016-04-28T14:55:06Z","updated_at":"2016-04-28T14:55:06Z","body":"ok thanks\r\n"}}