1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #35531 from boblail/issue-35519

Update documentation on upsert_all so that it is correct for Postgres

[ci skip]
This commit is contained in:
Ryuta Kamizono 2019-03-09 20:50:53 +09:00 committed by GitHub
commit 9175a44532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,11 +243,15 @@ module ActiveRecord
#
# ==== Examples
#
# # Insert multiple records, performing an upsert when records have duplicate ISBNs
# # Given a Unique Index on books.isbn and the following record:
# Book.create!(title: 'Rework', author: 'David', isbn: '1')
#
# # Insert multiple records, allowing new records with the same ISBN
# # as an existing record to overwrite the existing record.
# # ('Eloquent Ruby' will overwrite 'Rework' because its ISBN is duplicate)
# Book.upsert_all([
# { title: 'Rework', author: 'David', isbn: '1' },
# { title: 'Eloquent Ruby', author: 'Russ', isbn: '1' }
# { title: 'Eloquent Ruby', author: 'Russ', isbn: '1' },
# { title: 'Clean Code', author: 'Robert', isbn: '2' }
# ],
# unique_by: { columns: %w[ isbn ] })
#