Class: CaseForm::Element::ComplexError

Inherits:
Error
  • Object
show all
Defined in:
lib/case_form/element/errors/complex_error.rb

Constant Summary

Constants inherited from Base

Base::HTML_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#builder, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from CaseForm::ElementExt::Naming

#object_human_model_name, #sanitized_object_name, #singularize_model_name

Constructor Details

This class inherits a constructor from CaseForm::Element::Base

Instance Method Details

#generateObject

Generate all error messages as HTML <ul> list with optional header and message.



8
9
10
11
12
13
14
15
# File 'lib/case_form/element/errors/complex_error.rb', line 8

def generate
  contents = []
  contents << template.(header_tag, header_message) unless options[:header_message] == false
  contents << template.(message_tag, message)       unless options[:message] == false
  contents << template.(:ul, error_messages)
  
  template.(error_tag, contents.join.html_safe, html_options)
end