From 12719f9d6a5dd8e998c6f3f71f2145bf48a14133 Mon Sep 17 00:00:00 2001 From: davidauza-engineer Date: Sat, 25 Jan 2020 13:46:04 -0500 Subject: [PATCH] Update Migration number to ensure consistency on the documentation [ci skip] Updated Migration number to 6.0 as there were cases where it did show 5.0 and 5.2 which may lead to confusion on a newcomer reader. --- guides/source/active_record_basics.md | 2 +- guides/source/association_basics.md | 28 +++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md index 9a09d7c92b..e5c27ea90d 100644 --- a/guides/source/active_record_basics.md +++ b/guides/source/active_record_basics.md @@ -366,7 +366,7 @@ database that Active Record supports using `rake`. Here's a migration that creates a table: ```ruby -class CreatePublications < ActiveRecord::Migration[5.0] +class CreatePublications < ActiveRecord::Migration[6.0] def change create_table :publications do |t| t.string :title diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index bab76e73b6..dd3fd3ae0c 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -101,7 +101,7 @@ NOTE: `belongs_to` associations _must_ use the singular term. If you used the pl The corresponding migration might look like this: ```ruby -class CreateBooks < ActiveRecord::Migration[5.0] +class CreateBooks < ActiveRecord::Migration[6.0] def change create_table :authors do |t| t.string :name @@ -132,7 +132,7 @@ end The corresponding migration might look like this: ```ruby -class CreateSuppliers < ActiveRecord::Migration[5.0] +class CreateSuppliers < ActiveRecord::Migration[6.0] def change create_table :suppliers do |t| t.string :name @@ -176,7 +176,7 @@ NOTE: The name of the other model is pluralized when declaring a `has_many` asso The corresponding migration might look like this: ```ruby -class CreateAuthors < ActiveRecord::Migration[5.0] +class CreateAuthors < ActiveRecord::Migration[6.0] def change create_table :authors do |t| t.string :name @@ -218,7 +218,7 @@ end The corresponding migration might look like this: ```ruby -class CreateAppointments < ActiveRecord::Migration[5.0] +class CreateAppointments < ActiveRecord::Migration[6.0] def change create_table :physicians do |t| t.string :name @@ -304,7 +304,7 @@ end The corresponding migration might look like this: ```ruby -class CreateAccountHistories < ActiveRecord::Migration[5.0] +class CreateAccountHistories < ActiveRecord::Migration[6.0] def change create_table :suppliers do |t| t.string :name @@ -345,7 +345,7 @@ end The corresponding migration might look like this: ```ruby -class CreateAssembliesAndParts < ActiveRecord::Migration[5.0] +class CreateAssembliesAndParts < ActiveRecord::Migration[6.0] def change create_table :assemblies do |t| t.string :name @@ -384,7 +384,7 @@ end The corresponding migration might look like this: ```ruby -class CreateSuppliers < ActiveRecord::Migration[5.2] +class CreateSuppliers < ActiveRecord::Migration[6.0] def change create_table :suppliers do |t| t.string :name @@ -466,7 +466,7 @@ Similarly, you can retrieve `@product.pictures`. If you have an instance of the `Picture` model, you can get to its parent via `@picture.imageable`. To make this work, you need to declare both a foreign key column and a type column in the model that declares the polymorphic interface: ```ruby -class CreatePictures < ActiveRecord::Migration[5.2] +class CreatePictures < ActiveRecord::Migration[6.0] def change create_table :pictures do |t| t.string :name @@ -483,7 +483,7 @@ end This migration can be simplified by using the `t.references` form: ```ruby -class CreatePictures < ActiveRecord::Migration[5.0] +class CreatePictures < ActiveRecord::Migration[6.0] def change create_table :pictures do |t| t.string :name @@ -514,7 +514,7 @@ With this setup, you can retrieve `@employee.subordinates` and `@employee.manage In your migrations/schema, you will add a references column to the model itself. ```ruby -class CreateEmployees < ActiveRecord::Migration[5.0] +class CreateEmployees < ActiveRecord::Migration[6.0] def change create_table :employees do |t| t.references :manager @@ -575,7 +575,7 @@ end This declaration needs to be backed up by a corresponding foreign key column in the books table. For a brand new table, the migration might look something like this: ```ruby -class CreateBooks < ActiveRecord::Migration[5.0] +class CreateBooks < ActiveRecord::Migration[6.0] def change create_table :books do |t| t.datetime :published_at @@ -589,7 +589,7 @@ end Whereas for an existing table, it might look like this: ```ruby -class AddAuthorToBooks < ActiveRecord::Migration[5.0] +class AddAuthorToBooks < ActiveRecord::Migration[6.0] def change add_reference :books, :author end @@ -619,7 +619,7 @@ end These need to be backed up by a migration to create the `assemblies_parts` table. This table should be created without a primary key: ```ruby -class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[5.2] +class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[6.0] def change create_table :assemblies_parts, id: false do |t| t.bigint :assembly_id @@ -637,7 +637,7 @@ We pass `id: false` to `create_table` because that table does not represent a mo You can also use the method `create_join_table` ```ruby -class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[5.0] +class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[6.0] def change create_join_table :assemblies, :parts do |t| t.index :assembly_id