Move same EE ApplicationSetting validations to a single validation
All threads resolved!
All threads resolved!
Compare changes
- Abdul Wadood authored
We can pass multiple attributes to a single validation call. Therefore, we have moved the same validations to a single validation call which will reduce code duplication. By default numericality option does not allow nil values so using presence of is redundant. See https://guides.rubyonrails.org/active_record_validations.html#numericality.
+ 16
− 49
@@ -20,45 +20,22 @@ module ApplicationSetting
@@ -20,45 +20,22 @@ module ApplicationSetting
@@ -82,18 +59,6 @@ module ApplicationSetting
@@ -82,18 +59,6 @@ module ApplicationSetting
numericality: { only_integer: true, greater_than: 0, less_than_or_equal_to: Elastic::ProcessBookkeepingService::SHARDS_MAX }
@@ -110,6 +75,7 @@ module ApplicationSetting
@@ -110,6 +75,7 @@ module ApplicationSetting
@@ -121,10 +87,6 @@ module ApplicationSetting
@@ -121,10 +87,6 @@ module ApplicationSetting
@@ -147,7 +109,12 @@ module ApplicationSetting
@@ -147,7 +109,12 @@ module ApplicationSetting
exclusion: { in: [true], message: -> (object, data) { _("can't be enabled when delayed group deletion is disabled") } },
validates :dashboard_limit, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :dashboard_limit_enabled, inclusion: { in: [true, false], message: 'must be a boolean value' }