1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/validators/database_provider_validator.rb
Sylvain 70803ee41b (api) validate auth providers data
+ remove legacy code
2022-05-04 12:27:48 +02:00

11 lines
343 B
Ruby

# frozen_string_literal: true
# Validates there's only one database provider
class DatabaseProviderValidator < ActiveModel::Validator
def validate(record)
return if DatabaseProvider.count.zero?
record.errors[:id] << I18n.t('app.admin.authentication_new.a_local_database_provider_already_exists_unable_to_create_another')
end
end