Merge branch 'deprecated-passing-activerecord-objects' into 'master'

Fix deprecation: Passing ActiveRecord::Base objects to sanitize_sql_hash_for_assignment

See merge request gitlab-org/gitlab-ce!23818
This commit is contained in:
Stan Hu 2018-12-14 06:12:46 +00:00
commit 4f10493bc0
3 changed files with 10 additions and 5 deletions

View file

@ -57,7 +57,7 @@ module Labels
def update_issuables(new_label, label_ids)
LabelLink
.where(label: label_ids)
.update_all(label_id: new_label)
.update_all(label_id: new_label.id)
end
# rubocop: enable CodeReuse/ActiveRecord
@ -65,7 +65,7 @@ module Labels
def update_resource_label_events(new_label, label_ids)
ResourceLabelEvent
.where(label: label_ids)
.update_all(label_id: new_label)
.update_all(label_id: new_label.id)
end
# rubocop: enable CodeReuse/ActiveRecord
@ -73,7 +73,7 @@ module Labels
def update_issue_board_lists(new_label, label_ids)
List
.where(label: label_ids)
.update_all(label_id: new_label)
.update_all(label_id: new_label.id)
end
# rubocop: enable CodeReuse/ActiveRecord
@ -81,7 +81,7 @@ module Labels
def update_priorities(new_label, label_ids)
LabelPriority
.where(label: label_ids)
.update_all(label_id: new_label)
.update_all(label_id: new_label.id)
end
# rubocop: enable CodeReuse/ActiveRecord

View file

@ -0,0 +1,5 @@
---
title: 'Fix deprecation: Passing ActiveRecord::Base objects to sanitize_sql_hash_for_assignment'
merge_request: 23818
author: Jasper Maes
type: other

View file

@ -116,7 +116,7 @@ module API
end
MergeRequest.where(source_project: @project, source_branch: ref)
.update_all(head_pipeline_id: pipeline) if pipeline.latest?
.update_all(head_pipeline_id: pipeline.id) if pipeline.latest?
present status, with: Entities::CommitStatus
rescue StateMachines::InvalidTransition => e