1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/app/validators/database_provider_validator.rb

11 lines
314 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Validates there's only one database provider
class DatabaseProviderValidator < ActiveModel::Validator
def validate(record)
return if DatabaseProvider.count.zero?
2023-02-24 17:26:55 +01:00
record.errors.add(:id, I18n.t('authentication_providers.local_database_provider_already_exists'))
end
end