Class: MergeRequestsClosingIssues

Inherits:
ApplicationRecord show all
Includes:
BulkInsertSafe
Defined in:
app/models/merge_requests_closing_issues.rb

Constant Summary

Constants included from BulkInsertSafe

BulkInsertSafe::ALLOWED_CALLBACKS, BulkInsertSafe::DEFAULT_BATCH_SIZE, BulkInsertSafe::MethodNotAllowedError, BulkInsertSafe::PrimaryKeySetError

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Class Method Summary collapse

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.count_for_collection(ids, current_user) ⇒ Object



40
41
42
# File 'app/models/merge_requests_closing_issues.rb', line 40

def count_for_collection(ids, current_user)
  closing_merge_requests(ids, current_user).group(:issue_id).pluck('issue_id', Arel.sql('COUNT(*) as count'))
end

.count_for_issue(id, current_user) ⇒ Object



44
45
46
# File 'app/models/merge_requests_closing_issues.rb', line 44

def count_for_issue(id, current_user)
  closing_merge_requests(id, current_user).count
end

.preload_issueObject



36
37
38
# File 'app/models/merge_requests_closing_issues.rb', line 36

def preload_issue
  preload(:issue)
end

.preload_merge_request_for_authorizationObject



32
33
34
# File 'app/models/merge_requests_closing_issues.rb', line 32

def preload_merge_request_for_authorization
  preload(merge_request: [:target_project, :author])
end