lib/reform/form/active_model/validations.rb in reform-rails-0.2.5 vs lib/reform/form/active_model/validations.rb in reform-rails-0.2.6

- old
+ new

@@ -139,13 +139,13 @@ # rails expects this to return a stringified hash of the messages def to_s messages.to_s end - def add(key, error_text) + def add(key, error_text, **error_options) # use rails magic to get the correct error_text and make sure we still update details and fields - error = @amv_errors.add(key, error_text) + error = @amv_errors.add(key, error_text, **error_options) error = [error.message] unless error.is_a?(Array) # 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 # required otherwise in the custom_errors method we will add the actual message in the @@ -169,15 +169,15 @@ def full_messages base_errors = @amv_errors.full_messages form_fields = @amv_errors.instance_variable_get(:@base).instance_variable_get(:@fields) nested_errors = full_messages_for_nested_fields(form_fields) - + [base_errors, nested_errors].flatten.compact end private - + def full_messages_for_nested_fields(form_fields) form_fields.map { |field| full_messages_for_twin(field[1]) } end def full_messages_for_twin(object)