mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-05 16:24:21 +01:00
11 lines
312 B
Ruby
11 lines
312 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('authentication_providers.local_database_provider_already_exists')
|
|
end
|
|
end
|