diff options
Diffstat (limited to 'app/models/organization.rb')
-rw-r--r-- | app/models/organization.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/app/models/organization.rb b/app/models/organization.rb deleted file mode 100644 index cfbbbf1183e..00000000000 --- a/app/models/organization.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class Organization < ApplicationRecord - DEFAULT_ORGANIZATION_ID = 1 - - scope :without_default, -> { where.not(id: DEFAULT_ORGANIZATION_ID) } - - before_destroy :check_if_default_organization - - validates :name, - presence: true, - length: { maximum: 255 }, - uniqueness: { case_sensitive: false } - - def default? - id == DEFAULT_ORGANIZATION_ID - end - - private - - def check_if_default_organization - return unless default? - - raise ActiveRecord::RecordNotDestroyed, _('Cannot delete the default organization') - end -end |