aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-10-17 21:21:14 +0900
committerGitHub <noreply@github.com>2018-10-17 21:21:14 +0900
commitdbb5d57538337702b29ffb879417f2d28e422b93 (patch)
tree44fc0b5bdee97530c8d0e0d6e1cb93af69f39066 /guides
parent0f74fd1f816f941152a91578f62ea9cf702b9a98 (diff)
parentf7b27513f794a17e90b1a709e22e9777d88eb487 (diff)
downloadrails-dbb5d57538337702b29ffb879417f2d28e422b93.tar.gz
rails-dbb5d57538337702b29ffb879417f2d28e422b93.tar.bz2
rails-dbb5d57538337702b29ffb879417f2d28e422b93.zip
Merge pull request #32146 from abhikanojia/association_guide_fix
Remove index:true option from belongs to as defaults to true. [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index a2231c55d7..406b65d223 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -109,7 +109,7 @@ class CreateBooks < ActiveRecord::Migration[5.0]
end
create_table :books do |t|
- t.belongs_to :author, index: true
+ t.belongs_to :author
t.datetime :published_at
t.timestamps
end
@@ -140,7 +140,7 @@ class CreateSuppliers < ActiveRecord::Migration[5.0]
end
create_table :accounts do |t|
- t.belongs_to :supplier, index: true
+ t.belongs_to :supplier
t.string :account_number
t.timestamps
end
@@ -184,7 +184,7 @@ class CreateAuthors < ActiveRecord::Migration[5.0]
end
create_table :books do |t|
- t.belongs_to :author, index: true
+ t.belongs_to :author
t.datetime :published_at
t.timestamps
end
@@ -231,8 +231,8 @@ class CreateAppointments < ActiveRecord::Migration[5.0]
end
create_table :appointments do |t|
- t.belongs_to :physician, index: true
- t.belongs_to :patient, index: true
+ t.belongs_to :physician
+ t.belongs_to :patient
t.datetime :appointment_date
t.timestamps
end
@@ -312,13 +312,13 @@ class CreateAccountHistories < ActiveRecord::Migration[5.0]
end
create_table :accounts do |t|
- t.belongs_to :supplier, index: true
+ t.belongs_to :supplier
t.string :account_number
t.timestamps
end
create_table :account_histories do |t|
- t.belongs_to :account, index: true
+ t.belongs_to :account
t.integer :credit_rating
t.timestamps
end
@@ -358,8 +358,8 @@ class CreateAssembliesAndParts < ActiveRecord::Migration[5.0]
end
create_table :assemblies_parts, id: false do |t|
- t.belongs_to :assembly, index: true
- t.belongs_to :part, index: true
+ t.belongs_to :assembly
+ t.belongs_to :part
end
end
end
@@ -517,7 +517,7 @@ In your migrations/schema, you will add a references column to the model itself.
class CreateEmployees < ActiveRecord::Migration[5.0]
def change
create_table :employees do |t|
- t.references :manager, index: true
+ t.references :manager
t.timestamps
end
end