提交 12c7b101 编写于 作者: R Ryuta Kamizono

Remove and flip `index: true` for `references` in the doc [ci skip]

Follow up #32146.
上级 dbb5d575
......@@ -348,8 +348,8 @@ def [](name)
#
# create_table :taggings do |t|
# t.references :tag, index: { name: 'index_taggings_on_tag_id' }
# t.references :tagger, polymorphic: true, index: true
# t.references :taggable, polymorphic: { default: 'Photo' }
# t.references :tagger, polymorphic: true
# t.references :taggable, polymorphic: { default: 'Photo' }, index: false
# end
def column(name, type, options = {})
name = name.to_s
......
......@@ -846,17 +846,17 @@ def index_name_exists?(table_name, index_name)
# [<tt>:null</tt>]
# Whether the column allows nulls. Defaults to true.
#
# ====== Create a user_id bigint column
# ====== Create a user_id bigint column without a index
#
# add_reference(:products, :user)
# add_reference(:products, :user, index: false)
#
# ====== Create a user_id string column
#
# add_reference(:products, :user, type: :string)
#
# ====== Create supplier_id, supplier_type columns and appropriate index
# ====== Create supplier_id, supplier_type columns
#
# add_reference(:products, :supplier, polymorphic: true, index: true)
# add_reference(:products, :supplier, polymorphic: true)
#
# ====== Create a supplier_id column with a unique index
#
......@@ -884,7 +884,7 @@ def add_reference(table_name, ref_name, **options)
#
# ====== Remove the reference
#
# remove_reference(:products, :user, index: true)
# remove_reference(:products, :user, index: false)
#
# ====== Remove polymorphic reference
#
......@@ -892,7 +892,7 @@ def add_reference(table_name, ref_name, **options)
#
# ====== Remove the reference with a foreign key
#
# remove_reference(:products, :user, index: true, foreign_key: true)
# remove_reference(:products, :user, foreign_key: true)
#
def remove_reference(table_name, ref_name, foreign_key: false, polymorphic: false, **options)
if foreign_key
......
......@@ -487,7 +487,7 @@ class CreatePictures < ActiveRecord::Migration[5.0]
def change
create_table :pictures do |t|
t.string :name
t.references :imageable, polymorphic: true, index: true
t.references :imageable, polymorphic: true
t.timestamps
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册