diff options
Diffstat (limited to 'app')
149 files changed, 150 insertions, 150 deletions
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 1b78fd04ebb..a3a1748142f 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AbuseReport < ActiveRecord::Base +class AbuseReport < ApplicationRecord include CacheMarkdownField cache_markdown_field :message, pipeline: :single_line diff --git a/app/models/appearance.rb b/app/models/appearance.rb index bdee9b2b73c..2815a117f7f 100644 --- a/app/models/appearance.rb +++ b/app/models/appearance.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Appearance < ActiveRecord::Base +class Appearance < ApplicationRecord include CacheableAttributes include CacheMarkdownField include ObjectStorage::BackgroundMove diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 9cc7c0a1b97..9e91e4ab4b9 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ApplicationSetting < ActiveRecord::Base +class ApplicationSetting < ApplicationRecord include CacheableAttributes include CacheMarkdownField include TokenAuthenticatable diff --git a/app/models/application_setting/term.rb b/app/models/application_setting/term.rb index 498701ba22b..723540c9b91 100644 --- a/app/models/application_setting/term.rb +++ b/app/models/application_setting/term.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ApplicationSetting - class Term < ActiveRecord::Base + class Term < ApplicationRecord include CacheMarkdownField has_many :term_agreements diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 8508c88d406..6ef2914ac11 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AuditEvent < ActiveRecord::Base +class AuditEvent < ApplicationRecord serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize belongs_to :user, foreign_key: :author_id diff --git a/app/models/award_emoji.rb b/app/models/award_emoji.rb index ddc516ccb60..e26162f6151 100644 --- a/app/models/award_emoji.rb +++ b/app/models/award_emoji.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AwardEmoji < ActiveRecord::Base +class AwardEmoji < ApplicationRecord DOWNVOTE_NAME = "thumbsdown".freeze UPVOTE_NAME = "thumbsup".freeze diff --git a/app/models/badge.rb b/app/models/badge.rb index f016654206b..a244ed473de 100644 --- a/app/models/badge.rb +++ b/app/models/badge.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Badge < ActiveRecord::Base +class Badge < ApplicationRecord include FromUnion # This structure sets the placeholders that the urls diff --git a/app/models/board.rb b/app/models/board.rb index 758a71d6903..e08db764f65 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Board < ActiveRecord::Base +class Board < ApplicationRecord belongs_to :group belongs_to :project diff --git a/app/models/board_group_recent_visit.rb b/app/models/board_group_recent_visit.rb index f5b75270595..2f1cd830791 100644 --- a/app/models/board_group_recent_visit.rb +++ b/app/models/board_group_recent_visit.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Tracks which boards in a specific group a user has visited -class BoardGroupRecentVisit < ActiveRecord::Base +class BoardGroupRecentVisit < ApplicationRecord belongs_to :user belongs_to :group belongs_to :board diff --git a/app/models/board_project_recent_visit.rb b/app/models/board_project_recent_visit.rb index 2a1b14b3ae0..236d88e909c 100644 --- a/app/models/board_project_recent_visit.rb +++ b/app/models/board_project_recent_visit.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Tracks which boards in a specific project a user has visited -class BoardProjectRecentVisit < ActiveRecord::Base +class BoardProjectRecentVisit < ApplicationRecord belongs_to :user belongs_to :project belongs_to :board diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 1c95abdd9ee..18fe2a9624f 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class BroadcastMessage < ActiveRecord::Base +class BroadcastMessage < ApplicationRecord include CacheMarkdownField include Sortable diff --git a/app/models/chat_name.rb b/app/models/chat_name.rb index 03b0af53046..0041595baba 100644 --- a/app/models/chat_name.rb +++ b/app/models/chat_name.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ChatName < ActiveRecord::Base +class ChatName < ApplicationRecord LAST_USED_AT_INTERVAL = 1.hour belongs_to :service diff --git a/app/models/chat_team.rb b/app/models/chat_team.rb index 4e724f9adf7..52b5a7b4a91 100644 --- a/app/models/chat_team.rb +++ b/app/models/chat_team.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ChatTeam < ActiveRecord::Base +class ChatTeam < ApplicationRecord validates :team_id, presence: true validates :namespace, uniqueness: true diff --git a/app/models/ci/build_metadata.rb b/app/models/ci/build_metadata.rb index cd8eb774cf5..f281cbd1d6f 100644 --- a/app/models/ci/build_metadata.rb +++ b/app/models/ci/build_metadata.rb @@ -3,7 +3,7 @@ module Ci # The purpose of this class is to store Build related data that can be disposed. # Data that should be persisted forever, should be stored with Ci::Build model. - class BuildMetadata < ActiveRecord::Base + class BuildMetadata < ApplicationRecord extend Gitlab::Ci::Model include Presentable include ChronicDurationAttribute diff --git a/app/models/ci/build_runner_session.rb b/app/models/ci/build_runner_session.rb index 457d7eeab6a..061eff090f5 100644 --- a/app/models/ci/build_runner_session.rb +++ b/app/models/ci/build_runner_session.rb @@ -3,7 +3,7 @@ module Ci # The purpose of this class is to store Build related runner session. # Data will be removed after transitioning from running to any state. - class BuildRunnerSession < ActiveRecord::Base + class BuildRunnerSession < ApplicationRecord extend Gitlab::Ci::Model self.table_name = 'ci_builds_runner_session' diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb index 75017f224a0..0a7a0e0772b 100644 --- a/app/models/ci/build_trace_chunk.rb +++ b/app/models/ci/build_trace_chunk.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class BuildTraceChunk < ActiveRecord::Base + class BuildTraceChunk < ApplicationRecord include FastDestroyAll include ::Gitlab::ExclusiveLeaseHelpers extend Gitlab::Ci::Model diff --git a/app/models/ci/build_trace_section.rb b/app/models/ci/build_trace_section.rb index a4bee59c83b..8be42eb48d6 100644 --- a/app/models/ci/build_trace_section.rb +++ b/app/models/ci/build_trace_section.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class BuildTraceSection < ActiveRecord::Base + class BuildTraceSection < ApplicationRecord extend Gitlab::Ci::Model belongs_to :build, class_name: 'Ci::Build' diff --git a/app/models/ci/build_trace_section_name.rb b/app/models/ci/build_trace_section_name.rb index cbdf3c4b673..c065cfea14e 100644 --- a/app/models/ci/build_trace_section_name.rb +++ b/app/models/ci/build_trace_section_name.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class BuildTraceSectionName < ActiveRecord::Base + class BuildTraceSectionName < ApplicationRecord extend Gitlab::Ci::Model belongs_to :project diff --git a/app/models/ci/group_variable.rb b/app/models/ci/group_variable.rb index 323ff560564..0e50265c7ba 100644 --- a/app/models/ci/group_variable.rb +++ b/app/models/ci/group_variable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class GroupVariable < ActiveRecord::Base + class GroupVariable < ApplicationRecord extend Gitlab::Ci::Model include HasVariable include Presentable diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 789bb293811..99512a7c1dd 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class JobArtifact < ActiveRecord::Base + class JobArtifact < ApplicationRecord include AfterCommitQueue include ObjectStorage::BackgroundMove extend Gitlab::Ci::Model diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 826b3f82bbf..41f380cc1e4 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Pipeline < ActiveRecord::Base + class Pipeline < ApplicationRecord extend Gitlab::Ci::Model include HasStatus include Importable @@ -184,7 +184,7 @@ module Ci scope :sort_by_merge_request_pipelines, -> do sql = 'CASE ci_pipelines.source WHEN (?) THEN 0 ELSE 1 END, ci_pipelines.id DESC' - query = ActiveRecord::Base.send(:sanitize_sql_array, [sql, sources[:merge_request_event]]) # rubocop:disable GitlabSecurity/PublicSend + query = ApplicationRecord.send(:sanitize_sql_array, [sql, sources[:merge_request_event]]) # rubocop:disable GitlabSecurity/PublicSend order(query) end diff --git a/app/models/ci/pipeline_chat_data.rb b/app/models/ci/pipeline_chat_data.rb index 8d37500fec5..65466a8c6f8 100644 --- a/app/models/ci/pipeline_chat_data.rb +++ b/app/models/ci/pipeline_chat_data.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class PipelineChatData < ActiveRecord::Base + class PipelineChatData < ApplicationRecord self.table_name = 'ci_pipeline_chat_data' belongs_to :chat_name diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb index 1c1f203bdb2..1454b2dfb39 100644 --- a/app/models/ci/pipeline_schedule.rb +++ b/app/models/ci/pipeline_schedule.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class PipelineSchedule < ActiveRecord::Base + class PipelineSchedule < ApplicationRecord extend Gitlab::Ci::Model include Importable include IgnorableColumn diff --git a/app/models/ci/pipeline_schedule_variable.rb b/app/models/ci/pipeline_schedule_variable.rb index fbb9987cab2..be6e5e76c31 100644 --- a/app/models/ci/pipeline_schedule_variable.rb +++ b/app/models/ci/pipeline_schedule_variable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class PipelineScheduleVariable < ActiveRecord::Base + class PipelineScheduleVariable < ApplicationRecord extend Gitlab::Ci::Model include HasVariable diff --git a/app/models/ci/pipeline_variable.rb b/app/models/ci/pipeline_variable.rb index 08514d6af4e..51a6272e1ff 100644 --- a/app/models/ci/pipeline_variable.rb +++ b/app/models/ci/pipeline_variable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class PipelineVariable < ActiveRecord::Base + class PipelineVariable < ApplicationRecord extend Gitlab::Ci::Model include HasVariable diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 43f040a91ae..07d00503861 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Runner < ActiveRecord::Base + class Runner < ApplicationRecord extend Gitlab::Ci::Model include Gitlab::SQL::Pattern include IgnorableColumn diff --git a/app/models/ci/runner_namespace.rb b/app/models/ci/runner_namespace.rb index 22b80b98551..6903e8a21a1 100644 --- a/app/models/ci/runner_namespace.rb +++ b/app/models/ci/runner_namespace.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class RunnerNamespace < ActiveRecord::Base + class RunnerNamespace < ApplicationRecord extend Gitlab::Ci::Model belongs_to :runner, inverse_of: :runner_namespaces, validate: true diff --git a/app/models/ci/runner_project.rb b/app/models/ci/runner_project.rb index 1a718d24141..f5bd50dc5a3 100644 --- a/app/models/ci/runner_project.rb +++ b/app/models/ci/runner_project.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class RunnerProject < ActiveRecord::Base + class RunnerProject < ApplicationRecord extend Gitlab::Ci::Model belongs_to :runner, inverse_of: :runner_projects diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 098f5189517..b25b0369666 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Stage < ActiveRecord::Base + class Stage < ApplicationRecord extend Gitlab::Ci::Model include Importable include HasStatus diff --git a/app/models/ci/trigger.rb b/app/models/ci/trigger.rb index 637148c4ce4..8927bb9bc18 100644 --- a/app/models/ci/trigger.rb +++ b/app/models/ci/trigger.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Trigger < ActiveRecord::Base + class Trigger < ApplicationRecord extend Gitlab::Ci::Model include IgnorableColumn include Presentable diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb index 0b52c690e93..5daf3dd192d 100644 --- a/app/models/ci/trigger_request.rb +++ b/app/models/ci/trigger_request.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class TriggerRequest < ActiveRecord::Base + class TriggerRequest < ApplicationRecord extend Gitlab::Ci::Model belongs_to :trigger diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb index 64836ea4fa4..a77bbef0fca 100644 --- a/app/models/ci/variable.rb +++ b/app/models/ci/variable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Variable < ActiveRecord::Base + class Variable < ApplicationRecord extend Gitlab::Ci::Model include HasVariable include Presentable diff --git a/app/models/clusters/applications/cert_manager.rb b/app/models/clusters/applications/cert_manager.rb index c758577815a..ac0e7eb03bc 100644 --- a/app/models/clusters/applications/cert_manager.rb +++ b/app/models/clusters/applications/cert_manager.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class CertManager < ActiveRecord::Base + class CertManager < ApplicationRecord VERSION = 'v0.5.2'.freeze self.table_name = 'clusters_applications_cert_managers' diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb index 423071ec024..71aff00077d 100644 --- a/app/models/clusters/applications/helm.rb +++ b/app/models/clusters/applications/helm.rb @@ -4,7 +4,7 @@ require 'openssl' module Clusters module Applications - class Helm < ActiveRecord::Base + class Helm < ApplicationRecord self.table_name = 'clusters_applications_helm' attr_encrypted :ca_key, diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb index 567f1a2267f..376d54aab2c 100644 --- a/app/models/clusters/applications/ingress.rb +++ b/app/models/clusters/applications/ingress.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class Ingress < ActiveRecord::Base + class Ingress < ApplicationRecord VERSION = '1.1.2'.freeze self.table_name = 'clusters_applications_ingress' diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb index 7efcc175f9f..f86ff3551a1 100644 --- a/app/models/clusters/applications/jupyter.rb +++ b/app/models/clusters/applications/jupyter.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class Jupyter < ActiveRecord::Base + class Jupyter < ApplicationRecord VERSION = '0.9-174bbd5'.freeze self.table_name = 'clusters_applications_jupyter' diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb index 8afd548f3e3..f7e54833296 100644 --- a/app/models/clusters/applications/knative.rb +++ b/app/models/clusters/applications/knative.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class Knative < ActiveRecord::Base + class Knative < ApplicationRecord VERSION = '0.3.0'.freeze REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'.freeze METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'.freeze diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index fa7ce363531..954c29da196 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class Prometheus < ActiveRecord::Base + class Prometheus < ApplicationRecord include PrometheusAdapter VERSION = '6.7.3' diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index ec8f5cc40c0..8cb81bfcbe4 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -2,7 +2,7 @@ module Clusters module Applications - class Runner < ActiveRecord::Base + class Runner < ApplicationRecord VERSION = '0.3.0'.freeze self.table_name = 'clusters_applications_runners' diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 5156c7d7514..d9dec680beb 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Clusters - class Cluster < ActiveRecord::Base + class Cluster < ApplicationRecord include Presentable include Gitlab::Utils::StrongMemoize include FromUnion diff --git a/app/models/clusters/group.rb b/app/models/clusters/group.rb index 2b08a9e47f0..27f39b53579 100644 --- a/app/models/clusters/group.rb +++ b/app/models/clusters/group.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Clusters - class Group < ActiveRecord::Base + class Group < ApplicationRecord self.table_name = 'cluster_groups' belongs_to :cluster, class_name: 'Clusters::Cluster' diff --git a/app/models/clusters/kubernetes_namespace.rb b/app/models/clusters/kubernetes_namespace.rb index 7fc75e00cd0..b0c4900546e 100644 --- a/app/models/clusters/kubernetes_namespace.rb +++ b/app/models/clusters/kubernetes_namespace.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Clusters - class KubernetesNamespace < ActiveRecord::Base + class KubernetesNamespace < ApplicationRecord include Gitlab::Kubernetes self.table_name = 'clusters_kubernetes_namespaces' diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index 7786b48429c..63ef7ba6b45 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -2,7 +2,7 @@ module Clusters module Platforms - class Kubernetes < ActiveRecord::Base + class Kubernetes < ApplicationRecord include Gitlab::Kubernetes include ReactiveCaching include EnumWithNil diff --git a/app/models/clusters/project.rb b/app/models/clusters/project.rb index 15092b1c9d2..d2b68b3f117 100644 --- a/app/models/clusters/project.rb +++ b/app/models/clusters/project.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Clusters - class Project < ActiveRecord::Base + class Project < ApplicationRecord self.table_name = 'cluster_projects' belongs_to :cluster, class_name: 'Clusters::Cluster' diff --git a/app/models/clusters/providers/gcp.rb b/app/models/clusters/providers/gcp.rb index 16b59cd9d14..390748bf252 100644 --- a/app/models/clusters/providers/gcp.rb +++ b/app/models/clusters/providers/gcp.rb @@ -2,7 +2,7 @@ module Clusters module Providers - class Gcp < ActiveRecord::Base + class Gcp < ApplicationRecord self.table_name = 'cluster_providers_gcp' belongs_to :cluster, inverse_of: :provider_gcp, class_name: 'Clusters::Cluster' diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 5f66a661324..f97dc38dab7 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CommitStatus < ActiveRecord::Base +class CommitStatus < ApplicationRecord include HasStatus include Importable include AfterCommitQueue diff --git a/app/models/concerns/atomic_internal_id.rb b/app/models/concerns/atomic_internal_id.rb index 4e15b60ccd1..ab3d9e923c0 100644 --- a/app/models/concerns/atomic_internal_id.rb +++ b/app/models/concerns/atomic_internal_id.rb @@ -7,7 +7,7 @@ # # For example, let's generate internal ids for Issue per Project: # ``` -# class Issue < ActiveRecord::Base +# class Issue < ApplicationRecord # has_internal_id :iid, scope: :project, init: ->(s) { s.project.issues.maximum(:iid) } # end # ``` diff --git a/app/models/concerns/ignorable_column.rb b/app/models/concerns/ignorable_column.rb index 5c1f7dfcd2a..3bec44dc79b 100644 --- a/app/models/concerns/ignorable_column.rb +++ b/app/models/concerns/ignorable_column.rb @@ -5,7 +5,7 @@ # # Example: # -# class User < ActiveRecord::Base +# class User < ApplicationRecord # include IgnorableColumn # # ignore_column :updated_at diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index 614c3242874..b140fca9b83 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -7,7 +7,7 @@ # # Usage: # -# class Issue < ActiveRecord::Base +# class Issue < ApplicationRecord # include Participable # # # ... diff --git a/app/models/concerns/reactive_caching.rb b/app/models/concerns/reactive_caching.rb index d2ead7130e5..1ab3b3ddc46 100644 --- a/app/models/concerns/reactive_caching.rb +++ b/app/models/concerns/reactive_caching.rb @@ -7,7 +7,7 @@ # # Example of use: # -# class Foo < ActiveRecord::Base +# class Foo < ApplicationRecord # include ReactiveCaching # # self.reactive_cache_key = ->(thing) { ["foo", thing.id] } diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index a479bef993c..70ac873a030 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -39,7 +39,7 @@ module ShaAttribute end def database_exists? - ActiveRecord::Base.connection + ApplicationRecord.connection true rescue diff --git a/app/models/concerns/strip_attribute.rb b/app/models/concerns/strip_attribute.rb index c9f5ba7793d..8f6a6244dd3 100644 --- a/app/models/concerns/strip_attribute.rb +++ b/app/models/concerns/strip_attribute.rb @@ -6,7 +6,7 @@ # # Usage: # -# class Milestone < ActiveRecord::Base +# class Milestone < ApplicationRecord # strip_attributes :title # end # diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb index cf057d774cf..39e12ac2b06 100644 --- a/app/models/container_repository.rb +++ b/app/models/container_repository.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ContainerRepository < ActiveRecord::Base +class ContainerRepository < ApplicationRecord include Gitlab::Utils::StrongMemoize belongs_to :project diff --git a/app/models/conversational_development_index/metric.rb b/app/models/conversational_development_index/metric.rb index c54537572d6..b91123be87e 100644 --- a/app/models/conversational_development_index/metric.rb +++ b/app/models/conversational_development_index/metric.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module ConversationalDevelopmentIndex - class Metric < ActiveRecord::Base + class Metric < ApplicationRecord include Presentable self.table_name = 'conversational_development_index_metrics' diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb index 71fd02fac86..15906ed8e06 100644 --- a/app/models/deploy_keys_project.rb +++ b/app/models/deploy_keys_project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class DeployKeysProject < ActiveRecord::Base +class DeployKeysProject < ApplicationRecord belongs_to :project belongs_to :deploy_key, inverse_of: :deploy_keys_projects diff --git a/app/models/deploy_token.rb b/app/models/deploy_token.rb index e3524305346..b0e570f52ba 100644 --- a/app/models/deploy_token.rb +++ b/app/models/deploy_token.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class DeployToken < ActiveRecord::Base +class DeployToken < ApplicationRecord include Expirable include TokenAuthenticatable include PolicyActor diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 428edfd88de..d847a0a11e4 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Deployment < ActiveRecord::Base +class Deployment < ApplicationRecord include AtomicInternalId include IidRoutes include AfterCommitQueue diff --git a/app/models/email.rb b/app/models/email.rb index 7c33c5c7e64..0ddaa049c3b 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Email < ActiveRecord::Base +class Email < ApplicationRecord include Sortable include Gitlab::SQL::Pattern diff --git a/app/models/environment.rb b/app/models/environment.rb index 3d909cc8e5c..25373c7a1f7 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Environment < ActiveRecord::Base +class Environment < ApplicationRecord include Gitlab::Utils::StrongMemoize # Used to generate random suffixes for the slug LETTERS = 'a'..'z' diff --git a/app/models/epic.rb b/app/models/epic.rb index ccd10593434..3693db1de33 100644 --- a/app/models/epic.rb +++ b/app/models/epic.rb @@ -2,7 +2,7 @@ # Placeholder class for model that is implemented in EE # It reserves '&' as a reference prefix, but the table does not exists in CE -class Epic < ActiveRecord::Base +class Epic < ApplicationRecord def self.link_reference_pattern nil end diff --git a/app/models/error_tracking/project_error_tracking_setting.rb b/app/models/error_tracking/project_error_tracking_setting.rb index 1e2bd3bda7f..8edc04cc268 100644 --- a/app/models/error_tracking/project_error_tracking_setting.rb +++ b/app/models/error_tracking/project_error_tracking_setting.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module ErrorTracking - class ProjectErrorTrackingSetting < ActiveRecord::Base + class ProjectErrorTrackingSetting < ApplicationRecord include Gitlab::Utils::StrongMemoize include ReactiveCaching diff --git a/app/models/event.rb b/app/models/event.rb index 6a35bca72c5..593acf5edfe 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Event < ActiveRecord::Base +class Event < ApplicationRecord include Sortable include IgnorableColumn include FromUnion diff --git a/app/models/fork_network.rb b/app/models/fork_network.rb index 1b9bf93cbbc..0323a8d222a 100644 --- a/app/models/fork_network.rb +++ b/app/models/fork_network.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ForkNetwork < ActiveRecord::Base +class ForkNetwork < ApplicationRecord belongs_to :root_project, class_name: 'Project' has_many :fork_network_members has_many :projects, through: :fork_network_members diff --git a/app/models/fork_network_member.rb b/app/models/fork_network_member.rb index 36c66f21b0b..f18c306cf91 100644 --- a/app/models/fork_network_member.rb +++ b/app/models/fork_network_member.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ForkNetworkMember < ActiveRecord::Base +class ForkNetworkMember < ApplicationRecord belongs_to :fork_network belongs_to :project belongs_to :forked_from_project, class_name: 'Project' diff --git a/app/models/gpg_key.rb b/app/models/gpg_key.rb index 077afffd358..116beac5c2a 100644 --- a/app/models/gpg_key.rb +++ b/app/models/gpg_key.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class GpgKey < ActiveRecord::Base +class GpgKey < ApplicationRecord KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze KEY_SUFFIX = '-----END PGP PUBLIC KEY BLOCK-----'.freeze diff --git a/app/models/gpg_key_subkey.rb b/app/models/gpg_key_subkey.rb index 440b588bc78..110bf451136 100644 --- a/app/models/gpg_key_subkey.rb +++ b/app/models/gpg_key_subkey.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class GpgKeySubkey < ActiveRecord::Base +class GpgKeySubkey < ApplicationRecord include ShaAttribute sha_attribute :keyid diff --git a/app/models/group_custom_attribute.rb b/app/models/group_custom_attribute.rb index 22f14885657..5ac6e5f2550 100644 --- a/app/models/group_custom_attribute.rb +++ b/app/models/group_custom_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class GroupCustomAttribute < ActiveRecord::Base +class GroupCustomAttribute < ApplicationRecord belongs_to :group validates :group, :key, :value, presence: true diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb index 1a8662db9fb..daf7ff4b771 100644 --- a/app/models/hooks/web_hook.rb +++ b/app/models/hooks/web_hook.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class WebHook < ActiveRecord::Base +class WebHook < ApplicationRecord include Sortable attr_encrypted :token, diff --git a/app/models/hooks/web_hook_log.rb b/app/models/hooks/web_hook_log.rb index 2d9f7594e8c..cfb1f3ec63b 100644 --- a/app/models/hooks/web_hook_log.rb +++ b/app/models/hooks/web_hook_log.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class WebHookLog < ActiveRecord::Base +class WebHookLog < ApplicationRecord belongs_to :web_hook serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize diff --git a/app/models/identity.rb b/app/models/identity.rb index acdde4f296b..8322b9bf35f 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Identity < ActiveRecord::Base +class Identity < ApplicationRecord include Sortable include CaseSensitivity diff --git a/app/models/identity/uniqueness_scopes.rb b/app/models/identity/uniqueness_scopes.rb index 674b735903f..ce68371ae87 100644 --- a/app/models/identity/uniqueness_scopes.rb +++ b/app/models/identity/uniqueness_scopes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Identity < ActiveRecord::Base +class Identity < ApplicationRecord # This module and method are defined in a separate file to allow EE to # redefine the `scopes` method before it is used in the `Identity` model. module UniquenessScopes diff --git a/app/models/import_export_upload.rb b/app/models/import_export_upload.rb index f0cc5aafcd4..60f5491849a 100644 --- a/app/models/import_export_upload.rb +++ b/app/models/import_export_upload.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ImportExportUpload < ActiveRecord::Base +class ImportExportUpload < ApplicationRecord include WithUploads include ObjectStorage::BackgroundMove diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb index e75c6eb2331..3f2d368a3f2 100644 --- a/app/models/internal_id.rb +++ b/app/models/internal_id.rb @@ -15,7 +15,7 @@ # In order to leverage InternalId for other usages, the idea is to # * Add `usage` value to enum # * (Optionally) add columns to `internal_ids` if needed for scope. -class InternalId < ActiveRecord::Base +class InternalId < ApplicationRecord belongs_to :project belongs_to :namespace diff --git a/app/models/issue.rb b/app/models/issue.rb index deab53d25e7..97c6dcc4745 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -2,7 +2,7 @@ require 'carrierwave/orm/activerecord' -class Issue < ActiveRecord::Base +class Issue < ApplicationRecord include AtomicInternalId include IidRoutes include Issuable diff --git a/app/models/issue/metrics.rb b/app/models/issue/metrics.rb index 0f5ee957ec9..8010cbc3d78 100644 --- a/app/models/issue/metrics.rb +++ b/app/models/issue/metrics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Issue::Metrics < ActiveRecord::Base +class Issue::Metrics < ApplicationRecord belongs_to :issue def record! diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index 400c0256945..fbd9be1fb43 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class IssueAssignee < ActiveRecord::Base +class IssueAssignee < ApplicationRecord belongs_to :issue belongs_to :assignee, class_name: "User", foreign_key: :user_id end diff --git a/app/models/key.rb b/app/models/key.rb index 8f93418b88b..b097be8cc89 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -2,7 +2,7 @@ require 'digest/md5' -class Key < ActiveRecord::Base +class Key < ApplicationRecord include AfterCommitQueue include Sortable diff --git a/app/models/label.rb b/app/models/label.rb index 96bdb7f17c5..024daeb4fae 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Label < ActiveRecord::Base +class Label < ApplicationRecord include CacheMarkdownField include Referable include Subscribable diff --git a/app/models/label_link.rb b/app/models/label_link.rb index 1d93a55e8e9..ffc0afd8e85 100644 --- a/app/models/label_link.rb +++ b/app/models/label_link.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class LabelLink < ActiveRecord::Base +class LabelLink < ApplicationRecord include Importable belongs_to :target, polymorphic: true, inverse_of: :label_links # rubocop:disable Cop/PolymorphicAssociations diff --git a/app/models/label_priority.rb b/app/models/label_priority.rb index 8ed8bb7577f..8f8f36efbfe 100644 --- a/app/models/label_priority.rb +++ b/app/models/label_priority.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class LabelPriority < ActiveRecord::Base +class LabelPriority < ApplicationRecord belongs_to :project belongs_to :label diff --git a/app/models/lfs_file_lock.rb b/app/models/lfs_file_lock.rb index 431d37e12e9..624b1d02e1a 100644 --- a/app/models/lfs_file_lock.rb +++ b/app/models/lfs_file_lock.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class LfsFileLock < ActiveRecord::Base +class LfsFileLock < ApplicationRecord belongs_to :project belongs_to :user diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 69c563545bb..e1aac691a64 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class LfsObject < ActiveRecord::Base +class LfsObject < ApplicationRecord include AfterCommitQueue include ObjectStorage::BackgroundMove diff --git a/app/models/lfs_objects_project.rb b/app/models/lfs_objects_project.rb index 353602800d7..f9afb18c1d7 100644 --- a/app/models/lfs_objects_project.rb +++ b/app/models/lfs_objects_project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class LfsObjectsProject < ActiveRecord::Base +class LfsObjectsProject < ApplicationRecord belongs_to :project belongs_to :lfs_object diff --git a/app/models/list.rb b/app/models/list.rb index 682af761ba0..17b1a8510cf 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class List < ActiveRecord::Base +class List < ApplicationRecord belongs_to :board belongs_to :label diff --git a/app/models/member.rb b/app/models/member.rb index 5dbc0c2eec9..8a06bff51b5 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Member < ActiveRecord::Base +class Member < ApplicationRecord include AfterCommitQueue include Sortable include Importable diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 19557fd476e..fdfe6ca614a 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequest < ActiveRecord::Base +class MergeRequest < ApplicationRecord include AtomicInternalId include IidRoutes include Issuable diff --git a/app/models/merge_request/metrics.rb b/app/models/merge_request/metrics.rb index 65e94a97b0a..05f8e18a2c1 100644 --- a/app/models/merge_request/metrics.rb +++ b/app/models/merge_request/metrics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequest::Metrics < ActiveRecord::Base +class MergeRequest::Metrics < ApplicationRecord belongs_to :merge_request belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :pipeline_id belongs_to :latest_closed_by, class_name: 'User' diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 2143571d1d4..ac8d3b98266 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequestDiff < ActiveRecord::Base +class MergeRequestDiff < ApplicationRecord include Sortable include Importable include ManualInverseAssociation diff --git a/app/models/merge_request_diff_commit.rb b/app/models/merge_request_diff_commit.rb index 4ad3690512d..b897bbc8cf5 100644 --- a/app/models/merge_request_diff_commit.rb +++ b/app/models/merge_request_diff_commit.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequestDiffCommit < ActiveRecord::Base +class MergeRequestDiffCommit < ApplicationRecord include ShaAttribute belongs_to :merge_request_diff diff --git a/app/models/merge_request_diff_file.rb b/app/models/merge_request_diff_file.rb index 16ec4ed470f..01ee82ae398 100644 --- a/app/models/merge_request_diff_file.rb +++ b/app/models/merge_request_diff_file.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequestDiffFile < ActiveRecord::Base +class MergeRequestDiffFile < ApplicationRecord include Gitlab::EncodingHelper include DiffFile diff --git a/app/models/merge_requests_closing_issues.rb b/app/models/merge_requests_closing_issues.rb index 242b65bedc0..61af50841ee 100644 --- a/app/models/merge_requests_closing_issues.rb +++ b/app/models/merge_requests_closing_issues.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MergeRequestsClosingIssues < ActiveRecord::Base +class MergeRequestsClosingIssues < ApplicationRecord belongs_to :merge_request belongs_to :issue diff --git a/app/models/milestone.rb b/app/models/milestone.rb index a3831ae3fa8..b4aad9e512e 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Milestone < ActiveRecord::Base +class Milestone < ApplicationRecord # Represents a "No Milestone" state used for filtering Issues and Merge # Requests that have no milestone assigned. MilestoneStruct = Struct.new(:title, :name, :id) diff --git a/app/models/note.rb b/app/models/note.rb index 2c9980b1a0d..081d6f91230 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -3,7 +3,7 @@ # A note on the root of an issue, merge request, commit, or snippet. # # A note of this type is never resolvable. -class Note < ActiveRecord::Base +class Note < ApplicationRecord extend ActiveModel::Naming include Participable include Mentionable diff --git a/app/models/note_diff_file.rb b/app/models/note_diff_file.rb index e369122003e..9afb94c869a 100644 --- a/app/models/note_diff_file.rb +++ b/app/models/note_diff_file.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class NoteDiffFile < ActiveRecord::Base +class NoteDiffFile < ApplicationRecord include DiffFile scope :for_commit_or_unresolved, -> do diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index e82eaf4e069..61af5c09ae4 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class NotificationSetting < ActiveRecord::Base +class NotificationSetting < ApplicationRecord include IgnorableColumn ignore_column :events diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb index 7a33ade826b..82901ceec01 100644 --- a/app/models/pages_domain.rb +++ b/app/models/pages_domain.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PagesDomain < ActiveRecord::Base +class PagesDomain < ApplicationRecord VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze VERIFICATION_THRESHOLD = 3.days.freeze diff --git a/app/models/personal_access_token.rb b/app/models/personal_access_token.rb index ed78a46eaf3..570112b63b7 100644 --- a/app/models/personal_access_token.rb +++ b/app/models/personal_access_token.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PersonalAccessToken < ActiveRecord::Base +class PersonalAccessToken < ApplicationRecord include Expirable include IgnorableColumn include TokenAuthenticatable diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb index 4635fc72dc7..35c718365b4 100644 --- a/app/models/pool_repository.rb +++ b/app/models/pool_repository.rb @@ -3,7 +3,7 @@ # The PoolRepository model is the database equivalent of an ObjectPool for Gitaly # That is; PoolRepository is the record in the database, ObjectPool is the # repository on disk -class PoolRepository < ActiveRecord::Base +class PoolRepository < ApplicationRecord include Shardable include AfterCommitQueue diff --git a/app/models/postgresql/replication_slot.rb b/app/models/postgresql/replication_slot.rb index e264fe88e47..74ccf23cf69 100644 --- a/app/models/postgresql/replication_slot.rb +++ b/app/models/postgresql/replication_slot.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Postgresql - class ReplicationSlot < ActiveRecord::Base + class ReplicationSlot < ApplicationRecord self.table_name = 'pg_replication_slots' # Returns true if there are any replication slots in use. diff --git a/app/models/programming_language.rb b/app/models/programming_language.rb index 5f0f313b7f9..375fbe9b5a9 100644 --- a/app/models/programming_language.rb +++ b/app/models/programming_language.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProgrammingLanguage < ActiveRecord::Base +class ProgrammingLanguage < ApplicationRecord validates :name, presence: true validates :color, allow_blank: false, color: true diff --git a/app/models/project.rb b/app/models/project.rb index 06010409574..82c2f9090c8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2,7 +2,7 @@ require 'carrierwave/orm/activerecord' -class Project < ActiveRecord::Base +class Project < ApplicationRecord include Gitlab::ConfigHelper include Gitlab::ShellAdapter include Gitlab::VisibilityLevel diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb index 2c590008db2..f95d3ab54e2 100644 --- a/app/models/project_authorization.rb +++ b/app/models/project_authorization.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectAuthorization < ActiveRecord::Base +class ProjectAuthorization < ApplicationRecord include FromUnion belongs_to :user diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb index e353a6443c4..f972c40f317 100644 --- a/app/models/project_auto_devops.rb +++ b/app/models/project_auto_devops.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectAutoDevops < ActiveRecord::Base +class ProjectAutoDevops < ApplicationRecord belongs_to :project enum deploy_strategy: { diff --git a/app/models/project_ci_cd_setting.rb b/app/models/project_ci_cd_setting.rb index 1dad235cc2b..1414164b703 100644 --- a/app/models/project_ci_cd_setting.rb +++ b/app/models/project_ci_cd_setting.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectCiCdSetting < ActiveRecord::Base +class ProjectCiCdSetting < ApplicationRecord belongs_to :project, inverse_of: :ci_cd_settings # The version of the schema that first introduced this model/table. diff --git a/app/models/project_custom_attribute.rb b/app/models/project_custom_attribute.rb index 4e767cb3b26..b0da586988a 100644 --- a/app/models/project_custom_attribute.rb +++ b/app/models/project_custom_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectCustomAttribute < ActiveRecord::Base +class ProjectCustomAttribute < ApplicationRecord belongs_to :project validates :project, :key, :value, presence: true diff --git a/app/models/project_daily_statistic.rb b/app/models/project_daily_statistic.rb index ff115dd010f..5ee11ab186e 100644 --- a/app/models/project_daily_statistic.rb +++ b/app/models/project_daily_statistic.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectDailyStatistic < ActiveRecord::Base +class ProjectDailyStatistic < ApplicationRecord belongs_to :project scope :of_project, -> (project) { where(project: project) } diff --git a/app/models/project_deploy_token.rb b/app/models/project_deploy_token.rb index 719c492a1ff..a55667496fb 100644 --- a/app/models/project_deploy_token.rb +++ b/app/models/project_deploy_token.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectDeployToken < ActiveRecord::Base +class ProjectDeployToken < ApplicationRecord belongs_to :project belongs_to :deploy_token, inverse_of: :project_deploy_tokens diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index e6787236c4e..0542581c6e0 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectFeature < ActiveRecord::Base +class ProjectFeature < ApplicationRecord # == Project features permissions # # Grants access level to project tools diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index bc3759142ae..58b555c3581 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectGroupLink < ActiveRecord::Base +class ProjectGroupLink < ApplicationRecord include Expirable GUEST = 10 diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index aa0c121fe99..580e8dfd833 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -2,7 +2,7 @@ require 'carrierwave/orm/activerecord' -class ProjectImportData < ActiveRecord::Base +class ProjectImportData < ApplicationRecord belongs_to :project, inverse_of: :import_data attr_encrypted :credentials, key: Settings.attr_encrypted_db_key_base, diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index 488f0cb5971..1605345efd5 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectImportState < ActiveRecord::Base +class ProjectImportState < ApplicationRecord include AfterCommitQueue self.table_name = "project_mirror_data" diff --git a/app/models/project_repository.rb b/app/models/project_repository.rb index 38913f3f2f5..092efabd73f 100644 --- a/app/models/project_repository.rb +++ b/app/models/project_repository.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectRepository < ActiveRecord::Base +class ProjectRepository < ApplicationRecord include Shardable belongs_to :project, inverse_of: :project_repository diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index 781a197d56f..c020e72908c 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProjectStatistics < ActiveRecord::Base +class ProjectStatistics < ApplicationRecord belongs_to :project belongs_to :namespace diff --git a/app/models/prometheus_metric.rb b/app/models/prometheus_metric.rb index 5594594a48d..62090444f79 100644 --- a/app/models/prometheus_metric.rb +++ b/app/models/prometheus_metric.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PrometheusMetric < ActiveRecord::Base +class PrometheusMetric < ApplicationRecord belongs_to :project, validate: true, inverse_of: :prometheus_metrics enum group: { diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 597431be65a..ee0c94c20af 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProtectedBranch < ActiveRecord::Base +class ProtectedBranch < ApplicationRecord include ProtectedRef protected_ref_access_levels :merge, :push diff --git a/app/models/protected_branch/merge_access_level.rb b/app/models/protected_branch/merge_access_level.rb index b0d5c64e931..de240e40316 100644 --- a/app/models/protected_branch/merge_access_level.rb +++ b/app/models/protected_branch/merge_access_level.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProtectedBranch::MergeAccessLevel < ActiveRecord::Base +class ProtectedBranch::MergeAccessLevel < ApplicationRecord include ProtectedBranchAccess end diff --git a/app/models/protected_branch/push_access_level.rb b/app/models/protected_branch/push_access_level.rb index b2a88229853..bde1d29ad7f 100644 --- a/app/models/protected_branch/push_access_level.rb +++ b/app/models/protected_branch/push_access_level.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProtectedBranch::PushAccessLevel < ActiveRecord::Base +class ProtectedBranch::PushAccessLevel < ApplicationRecord include ProtectedBranchAccess end diff --git a/app/models/protected_tag.rb b/app/models/protected_tag.rb index d28ebabfe49..6b507429e57 100644 --- a/app/models/protected_tag.rb +++ b/app/models/protected_tag.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProtectedTag < ActiveRecord::Base +class ProtectedTag < ApplicationRecord include ProtectedRef validates :name, uniqueness: { scope: :project_id } diff --git a/app/models/protected_tag/create_access_level.rb b/app/models/protected_tag/create_access_level.rb index b06e55fb5dd..9fcfa7646a2 100644 --- a/app/models/protected_tag/create_access_level.rb +++ b/app/models/protected_tag/create_access_level.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProtectedTag::CreateAccessLevel < ActiveRecord::Base +class ProtectedTag::CreateAccessLevel < ApplicationRecord include ProtectedTagAccess def check_access(user) diff --git a/app/models/push_event_payload.rb b/app/models/push_event_payload.rb index c7769edf055..537859ec7b7 100644 --- a/app/models/push_event_payload.rb +++ b/app/models/push_event_payload.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PushEventPayload < ActiveRecord::Base +class PushEventPayload < ApplicationRecord include ShaAttribute belongs_to :event, inverse_of: :push_event_payload diff --git a/app/models/redirect_route.rb b/app/models/redirect_route.rb index c6bd4bb6dfa..2e4769364c6 100644 --- a/app/models/redirect_route.rb +++ b/app/models/redirect_route.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class RedirectRoute < ActiveRecord::Base +class RedirectRoute < ApplicationRecord belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations validates :source, presence: true diff --git a/app/models/release.rb b/app/models/release.rb index 0dae5c90394..746fc31a038 100644 --- a/app/models/release.rb +++ b/app/models/release.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Release < ActiveRecord::Base +class Release < ApplicationRecord include CacheMarkdownField include Gitlab::Utils::StrongMemoize diff --git a/app/models/releases/link.rb b/app/models/releases/link.rb index 6c507c47752..36ec33d3e3e 100644 --- a/app/models/releases/link.rb +++ b/app/models/releases/link.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Releases - class Link < ActiveRecord::Base + class Link < ApplicationRecord self.table_name = 'release_links' belongs_to :release diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index 5eba7ddd75c..5610cfe0f24 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class RemoteMirror < ActiveRecord::Base +class RemoteMirror < ApplicationRecord include AfterCommitQueue include MirrorAuthentication diff --git a/app/models/repository_language.rb b/app/models/repository_language.rb index b18142a2ac4..e6867f905e2 100644 --- a/app/models/repository_language.rb +++ b/app/models/repository_language.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class RepositoryLanguage < ActiveRecord::Base +class RepositoryLanguage < ApplicationRecord belongs_to :project belongs_to :programming_language diff --git a/app/models/resource_label_event.rb b/app/models/resource_label_event.rb index 3fd96b9dc18..f2c7cb6a65d 100644 --- a/app/models/resource_label_event.rb +++ b/app/models/resource_label_event.rb @@ -2,7 +2,7 @@ # This model is not used yet, it will be used for: # https://gitlab.com/gitlab-org/gitlab-ce/issues/48483 -class ResourceLabelEvent < ActiveRecord::Base +class ResourceLabelEvent < ApplicationRecord include Importable include Gitlab::Utils::StrongMemoize include CacheMarkdownField diff --git a/app/models/route.rb b/app/models/route.rb index 4b23dfa5778..7e3db54d4fe 100644 --- a/app/models/route.rb +++ b/app/models/route.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Route < ActiveRecord::Base +class Route < ApplicationRecord include CaseSensitivity belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index 6caab24143b..0427d5b9ca7 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SentNotification < ActiveRecord::Base +class SentNotification < ApplicationRecord serialize :position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize belongs_to :project diff --git a/app/models/service.rb b/app/models/service.rb index da523bfa426..c6d5eb353dc 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -2,7 +2,7 @@ # To add new service you should build a class inherited from Service # and implement a set of methods -class Service < ActiveRecord::Base +class Service < ApplicationRecord include Sortable include Importable include ProjectServicesLoggable diff --git a/app/models/shard.rb b/app/models/shard.rb index e39d4232486..335a279c6aa 100644 --- a/app/models/shard.rb +++ b/app/models/shard.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Shard < ActiveRecord::Base +class Shard < ApplicationRecord # Store shard names from the configuration file in the database. This is not a # list of active shards - we just want to assign an immutable, unique ID to # every shard name for easy indexing / referencing. diff --git a/app/models/snippet.rb b/app/models/snippet.rb index f23ddd64fe3..f4fdac2558c 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Snippet < ActiveRecord::Base +class Snippet < ApplicationRecord include Gitlab::VisibilityLevel include Redactable include CacheMarkdownField diff --git a/app/models/spam_log.rb b/app/models/spam_log.rb index ef3f974b959..5b9ece8373f 100644 --- a/app/models/spam_log.rb +++ b/app/models/spam_log.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SpamLog < ActiveRecord::Base +class SpamLog < ApplicationRecord belongs_to :user validates :user, presence: true diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 0f6ee0ddf7e..24a2b8b5167 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Subscription < ActiveRecord::Base +class Subscription < ApplicationRecord belongs_to :user belongs_to :project belongs_to :subscribable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations diff --git a/app/models/system_note_metadata.rb b/app/models/system_note_metadata.rb index d555ebe5322..55da37c9545 100644 --- a/app/models/system_note_metadata.rb +++ b/app/models/system_note_metadata.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SystemNoteMetadata < ActiveRecord::Base +class SystemNoteMetadata < ApplicationRecord # These notes's action text might contain a reference that is external. # We should always force a deep validation upon references that are found # in this note type. diff --git a/app/models/term_agreement.rb b/app/models/term_agreement.rb index 9b3c8ac68bd..a4a9dc10282 100644 --- a/app/models/term_agreement.rb +++ b/app/models/term_agreement.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class TermAgreement < ActiveRecord::Base +class TermAgreement < ApplicationRecord belongs_to :term, class_name: 'ApplicationSetting::Term' belongs_to :user diff --git a/app/models/timelog.rb b/app/models/timelog.rb index e04c644a53a..048134fbf04 100644 --- a/app/models/timelog.rb +++ b/app/models/timelog.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Timelog < ActiveRecord::Base +class Timelog < ApplicationRecord validates :time_spent, :user, presence: true validate :issuable_id_is_present diff --git a/app/models/todo.rb b/app/models/todo.rb index 2b0dee875a3..5dcc3e9945a 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Todo < ActiveRecord::Base +class Todo < ApplicationRecord include Sortable include FromUnion diff --git a/app/models/trending_project.rb b/app/models/trending_project.rb index 7b22e8cb760..810dee672b2 100644 --- a/app/models/trending_project.rb +++ b/app/models/trending_project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class TrendingProject < ActiveRecord::Base +class TrendingProject < ApplicationRecord belongs_to :project # The number of months to include in the trending calculation. diff --git a/app/models/u2f_registration.rb b/app/models/u2f_registration.rb index 37598173fd1..b4645462314 100644 --- a/app/models/u2f_registration.rb +++ b/app/models/u2f_registration.rb @@ -2,7 +2,7 @@ # Registration information for U2F (universal 2nd factor) devices, like Yubikeys -class U2fRegistration < ActiveRecord::Base +class U2fRegistration < ApplicationRecord belongs_to :user def self.register(user, app_id, params, challenges) diff --git a/app/models/upload.rb b/app/models/upload.rb index 20860f14b83..9bffdcdb2e7 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Upload < ActiveRecord::Base +class Upload < ApplicationRecord # Upper limit for foreground checksum processing CHECKSUM_THRESHOLD = 100.megabytes diff --git a/app/models/user.rb b/app/models/user.rb index d2be26370ff..e0c518a9b75 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -432,7 +432,7 @@ class User < ApplicationRecord fuzzy_arel_match(:name, query, lower_exact_match: true) .or(fuzzy_arel_match(:username, query, lower_exact_match: true)) .or(arel_table[:email].eq(query)) - ).reorder(order % { query: ActiveRecord::Base.connection.quote(query) }, :name) + ).reorder(order % { query: ApplicationRecord.connection.quote(query) }, :name) end # Limits the result set to users _not_ in the given query/list of IDs. diff --git a/app/models/user_agent_detail.rb b/app/models/user_agent_detail.rb index e2b2e7f1df9..fea1fce3c8d 100644 --- a/app/models/user_agent_detail.rb +++ b/app/models/user_agent_detail.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserAgentDetail < ActiveRecord::Base +class UserAgentDetail < ApplicationRecord belongs_to :subject, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations validates :user_agent, :ip_address, :subject_id, :subject_type, presence: true diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb index 76e7bc06b4e..027ee44c6a9 100644 --- a/app/models/user_callout.rb +++ b/app/models/user_callout.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserCallout < ActiveRecord::Base +class UserCallout < ApplicationRecord belongs_to :user # We use `UserCalloutEnums.feature_names` here so that EE can more easily diff --git a/app/models/user_custom_attribute.rb b/app/models/user_custom_attribute.rb index e0ffe8ebbfd..727975c3f6e 100644 --- a/app/models/user_custom_attribute.rb +++ b/app/models/user_custom_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserCustomAttribute < ActiveRecord::Base +class UserCustomAttribute < ApplicationRecord belongs_to :user validates :user_id, :key, :value, presence: true diff --git a/app/models/user_interacted_project.rb b/app/models/user_interacted_project.rb index 5fc59b274f5..f6f72f4b77a 100644 --- a/app/models/user_interacted_project.rb +++ b/app/models/user_interacted_project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserInteractedProject < ActiveRecord::Base +class UserInteractedProject < ApplicationRecord belongs_to :user belongs_to :project diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 32d0407800f..282b192167f 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserPreference < ActiveRecord::Base +class UserPreference < ApplicationRecord # We could use enums, but Rails 4 doesn't support multiple # enum options with same name for multiple fields, also it creates # extra methods that aren't really needed here. diff --git a/app/models/user_status.rb b/app/models/user_status.rb index 2bbb0c59ac1..6ced4f56823 100644 --- a/app/models/user_status.rb +++ b/app/models/user_status.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserStatus < ActiveRecord::Base +class UserStatus < ApplicationRecord include CacheMarkdownField self.primary_key = :user_id diff --git a/app/models/user_synced_attributes_metadata.rb b/app/models/user_synced_attributes_metadata.rb index 7115262942d..5aacf11b1cb 100644 --- a/app/models/user_synced_attributes_metadata.rb +++ b/app/models/user_synced_attributes_metadata.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UserSyncedAttributesMetadata < ActiveRecord::Base +class UserSyncedAttributesMetadata < ApplicationRecord belongs_to :user validates :user, presence: true diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb index bdaf58ae1c1..9be6bd2e6f3 100644 --- a/app/models/users_star_project.rb +++ b/app/models/users_star_project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class UsersStarProject < ActiveRecord::Base +class UsersStarProject < ApplicationRecord belongs_to :project, counter_cache: :star_count, touch: true belongs_to :user |