database_consistency
Advanced tools
@@ -72,3 +72,3 @@ # frozen_string_literal: true | ||
| Helper.check_inclusion?(validator.attributes, column.name) && | ||
| validator.options[:in].include?(nil) | ||
| Helper.inclusion_validator_values(validator).include?(nil) | ||
| end | ||
@@ -75,0 +75,0 @@ end |
@@ -5,3 +5,3 @@ # frozen_string_literal: true | ||
| # The module contains helper methods | ||
| module Helper | ||
| module Helper # rubocop:disable Metrics/ModuleLength | ||
| module_function | ||
@@ -116,2 +116,12 @@ | ||
| def inclusion_validator_values(validator) | ||
| value = validator.options[:in] | ||
| if value.is_a?(Proc) && value.arity.zero? | ||
| value.call | ||
| else | ||
| Array.wrap(value) | ||
| end | ||
| end | ||
| def btree_index?(index) | ||
@@ -118,0 +128,0 @@ (index.type.nil? || index.type.to_s == 'btree') && |
| # frozen_string_literal: true | ||
| module DatabaseConsistency | ||
| VERSION = '2.0.7' | ||
| VERSION = '2.0.8' | ||
| end |