diff --git a/lib/sequent/core/helpers/attribute_support.rb b/lib/sequent/core/helpers/attribute_support.rb index 1173491c..3f129aaf 100644 --- a/lib/sequent/core/helpers/attribute_support.rb +++ b/lib/sequent/core/helpers/attribute_support.rb @@ -63,12 +63,13 @@ def attrs(args) Sequent::Core::Helpers::DefaultValidators.for(type).add_validations_for(self, attribute) end - next unless type.instance_of?(Sequent::Core::Helpers::ArrayWithType) || - (included_modules.include?(ActiveModel::Validations) && - type.included_modules.include?(Sequent::Core::Helpers::AttributeSupport)) + is_array = type.instance_of?(Sequent::Core::Helpers::ArrayWithType) + needs_validation = included_modules.include?(ActiveModel::Validations) && + type.included_modules.include?(Sequent::Core::Helpers::AttributeSupport) - associations << attribute + associations << attribute if is_array || needs_validation end + if included_modules.include?(ActiveModel::Validations) && associations.present? validates_with Sequent::Core::Helpers::AssociationValidator, associations: associations end