mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Rubocop upgraded #2711
This commit is contained in:
parent
59c73fca9e
commit
7530d6ecab
33 changed files with 115 additions and 91 deletions
|
@ -9,7 +9,7 @@ class DateTimeIso8601Validator < ActiveModel::EachValidator
|
|||
return true if value.empty?
|
||||
|
||||
begin
|
||||
DateTime.parse(value)
|
||||
DateTime.zone.parse(value)
|
||||
rescue => _e
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class ObjectCountValidator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, value)
|
||||
min, max = options[:min].call, options[:max].call
|
||||
return if value.reject(&:marked_for_destruction?).length.between?(min, max)
|
||||
return if value.count { |i| !i.marked_for_destruction? }.between?(min, max)
|
||||
association = options[:association] || attribute
|
||||
record.errors.add(association, :out_of_range, { min: min, max: max })
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue