{"action":"closed","issue":{"url":"https://api.github.com/repos/jendiamond/railsgirls-signup/issues/2","repository_url":"https://api.github.com/repos/jendiamond/railsgirls-signup","labels_url":"https://api.github.com/repos/jendiamond/railsgirls-signup/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/jendiamond/railsgirls-signup/issues/2/comments","events_url":"https://api.github.com/repos/jendiamond/railsgirls-signup/issues/2/events","html_url":"https://github.com/jendiamond/railsgirls-signup/issues/2","id":168492771,"number":2,"title":"Add Question & Answers Models","user":{"login":"jendiamond","id":751697,"avatar_url":"https://avatars.githubusercontent.com/u/751697?v=3","gravatar_id":"","url":"https://api.github.com/users/jendiamond","html_url":"https://github.com/jendiamond","followers_url":"https://api.github.com/users/jendiamond/followers","following_url":"https://api.github.com/users/jendiamond/following{/other_user}","gists_url":"https://api.github.com/users/jendiamond/gists{/gist_id}","starred_url":"https://api.github.com/users/jendiamond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jendiamond/subscriptions","organizations_url":"https://api.github.com/users/jendiamond/orgs","repos_url":"https://api.github.com/users/jendiamond/repos","events_url":"https://api.github.com/users/jendiamond/events{/privacy}","received_events_url":"https://api.github.com/users/jendiamond/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-30T23:45:46Z","updated_at":"2016-08-14T07:17:59Z","closed_at":"2016-08-14T07:17:59Z","body":"$ `rails g model Answer user_id:integer question_id:integer`\r\n\r\n$ `rails g scaffold Question boolean_question:boolean string_question:string text_question:text integer_question:integer`\r\n\r\n===\r\n\r\n\r\n#### User.rb\r\n```\r\nhas_many :answers\r\nhas_many :questions, through: :answers\r\n```\r\n\r\n#### Question.rb\r\n```\r\nhas_many :answers\r\nhas_many :users, through: :answers\r\n```\r\n\r\n#### Answer.rb (Join table)\r\n```\r\nbelongs_to :user\r\nbelongs_to :question\r\n```\r\n\r\n===\r\n\r\n  create_table \"answers\", force: :cascade do |t|\r\n    t.integer  \"user_id\"\r\n    t.integer  \"question_id\"\r\n    t.datetime \"created_at\",  null: false\r\n    t.datetime \"updated_at\",  null: false\r\n  end\r\n\r\n  create_table \"questions\", force: :cascade do |t|\r\n    t.boolean  \"boolean_question\"\r\n    t.string   \"string_question\"\r\n    t.text     \"text_question\"\r\n    t.integer  \"integer_question\"\r\n    t.datetime \"created_at\",       null: false\r\n    t.datetime \"updated_at\",       null: false\r\n  end\r\n\r\n---\r\n\r\n### Add Questions to the Form\r\n\r\nhttp://stackoverflow.com/questions/2182428/rails-nested-form-with-has-many-through-how-to-edit-attributes-of-join-model\r\n\r\n```\r\n<%= form_for(@topic) do |topic_form| %>\r\n  ...fields...\r\n  <%= topic_form.fields_for :linkers do |linker_form| %>\r\n    ...linker fields...\r\n    <%= linker_form.fields_for :article do |article_form| %>\r\n      ...article fields...\r\n```"}}
{"actor":{"display_login":"jendiamond"}}