Class: Interview::FormErrors
- Defined in:
- lib/interview/controls/form_errors.rb
Instance Attribute Summary
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Control
#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Constructor Details
This class inherits a constructor from Interview::Control
Instance Method Details
#build(b) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interview/controls/form_errors.rb', line 4 def build(b) object = find_attribute!(:object) if object.errors.any? b.section html_class: 'alert alert-danger' do b.text text: h.translate("errors.template.header", count: object.errors.count, model: object.class.model_name.human), style: 'h4' b.section style: 'ul' do object.errors..each do |msg| b.text text: msg, style: 'li' end end end end end |