{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/20705","labels_url":"https://api.github.com/repos/rails/rails/issues/20705/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/20705/comments","events_url":"https://api.github.com/repos/rails/rails/issues/20705/events","html_url":"https://github.com/rails/rails/issues/20705","id":91238936,"number":20705,"title":"Rails Guides: Generated migration different than one shown in guide","user":{"login":"onebree","id":9038433,"avatar_url":"https://avatars.githubusercontent.com/u/9038433?v=3","gravatar_id":"","url":"https://api.github.com/users/onebree","html_url":"https://github.com/onebree","followers_url":"https://api.github.com/users/onebree/followers","following_url":"https://api.github.com/users/onebree/following{/other_user}","gists_url":"https://api.github.com/users/onebree/gists{/gist_id}","starred_url":"https://api.github.com/users/onebree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onebree/subscriptions","organizations_url":"https://api.github.com/users/onebree/orgs","repos_url":"https://api.github.com/users/onebree/repos","events_url":"https://api.github.com/users/onebree/events{/privacy}","received_events_url":"https://api.github.com/users/onebree/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/docs","name":"docs","color":"02d7e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-26T12:34:27Z","updated_at":"2015-06-28T09:56:13Z","closed_at":null,"body":"**Rails 4.2.2**\r\n\r\nhttp://guides.rubyonrails.org/getting_started.html#generating-a-model\r\n\r\nI ran the rake command to create a Comment model and migration. The guide says the migration should look like (without the comments, of course):\r\n\r\n```ruby\r\nclass CreateComments < ActiveRecord::Migration\r\n  def change\r\n    create_table :comments do |t|\r\n      t.string :commenter\r\n      t.text :body\r\n \r\n      # this line adds an integer column called `article_id`.\r\n      t.references :article, index: true\r\n \r\n      t.timestamps null: false\r\n    end\r\n    add_foreign_key :comments, :articles\r\n  end\r\nend\r\n```\r\n\r\nHowever, my migration does not include the last line:\r\n```ruby\r\nclass CreateComments < ActiveRecord::Migration\r\n  def change\r\n    create_table :comments do |t|\r\n      t.string :commenter\r\n      t.text :body\r\n      t.references :article, index: true, foreign_key: true\r\n \r\n      t.timestamps null: false\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nOn the master branch, the [guide](https://github.com/rails/rails/blob/master/guides/source/getting_started.md#generating-a-model) has the same code block as me. While 4.2 Stable is the current guide posted online."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/116249849","html_url":"https://github.com/rails/rails/issues/20705#issuecomment-116249849","issue_url":"https://api.github.com/repos/rails/rails/issues/20705","id":116249849,"user":{"login":"vijaydev","id":146214,"avatar_url":"https://avatars.githubusercontent.com/u/146214?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaydev","html_url":"https://github.com/vijaydev","followers_url":"https://api.github.com/users/vijaydev/followers","following_url":"https://api.github.com/users/vijaydev/following{/other_user}","gists_url":"https://api.github.com/users/vijaydev/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaydev/subscriptions","organizations_url":"https://api.github.com/users/vijaydev/orgs","repos_url":"https://api.github.com/users/vijaydev/repos","events_url":"https://api.github.com/users/vijaydev/events{/privacy}","received_events_url":"https://api.github.com/users/vijaydev/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T09:56:13Z","updated_at":"2015-06-28T09:56:13Z","body":"@onebree the guide was not updated when the change was introduced. I've now updated the guide in 4-2-stable https://github.com/rails/rails/commit/eeed8ab7d27b6bccf0a4253c35389cf795d55420 and this will reflect in guides.rubyonrails.org when 4.2.4 or 5.0.0 comes out."}}