Skip to content

Commit c775fa4

Browse files
committed
upsert should accept update_only parameter like upsert_all does
1 parent 0d46f69 commit c775fa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/persistence.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def insert_all!(attributes, returning: nil, record_timestamps: nil)
249249
# go through Active Record's type casting and serialization.
250250
#
251251
# See #upsert_all for documentation.
252-
def upsert(attributes, on_duplicate: :update, returning: nil, unique_by: nil, record_timestamps: nil)
253-
upsert_all([ attributes ], on_duplicate: on_duplicate, returning: returning, unique_by: unique_by, record_timestamps: record_timestamps)
252+
def upsert(attributes, **kwargs)
253+
upsert_all([ attributes ], **kwargs)
254254
end
255255

256256
# Updates or inserts (upserts) multiple records into the database in a

0 commit comments

Comments
 (0)