diff --git a/lib/reform/form/active_model/validations.rb b/lib/reform/form/active_model/validations.rb index 889aa66..47d62e1 100644 --- a/lib/reform/form/active_model/validations.rb +++ b/lib/reform/form/active_model/validations.rb @@ -143,7 +143,8 @@ def to_s def add(key, error_text) # use rails magic to get the correct error_text and make sure we still update details and fields - text = @amv_errors.add(key, error_text) + error = @amv_errors.add(key, error_text) + error = [error.message] if error.respond_to?(:message) # using error_text instead of text to either keep the symbol which will be # magically replaced with the translate or directly the string - this is also @@ -153,7 +154,7 @@ def add(key, error_text) # but since messages method is actually already defined in `Reform::Contract::Result::Errors # we need to update the @dotted_errors instance variable to add or merge a new error - @dotted_errors.key?(key) ? @dotted_errors[key] |= text : @dotted_errors[key] = text + @dotted_errors.key?(key) ? @dotted_errors[key] |= error : @dotted_errors[key] = error instance_variable_set(:@dotted_errors, @dotted_errors) end