summaryrefslogtreecommitdiff
path: root/app/models/project_setting.rb
blob: 24d892290a6e6656a0173747ace2f5d2df9d2e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class ProjectSetting < ApplicationRecord
  belongs_to :project, inverse_of: :project_setting

  enum squash_option: {
    never: 0,
    always: 1,
    default_on: 2,
    default_off: 3
  }, _prefix: 'squash'

  self.primary_key = :project_id

  def squash_enabled_by_default?
    %w[always default_on].include?(squash_option)
  end

  def squash_readonly?
    %w[always never].include?(squash_option)
  end
end

ProjectSetting.prepend_mod