Class: Railsboot::ErrorsComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::ErrorsComponent
- Defined in:
- app/components/railsboot/errors_component.rb
Overview
ViewComponent: renders the errors block.
Instance Method Summary collapse
- #error_messages ⇒ Object
- #errors ⇒ Object
-
#initialize(*objects, **html_attributes) ⇒ ErrorsComponent
constructor
A new instance of ErrorsComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(*objects, **html_attributes) ⇒ ErrorsComponent
Returns a new instance of ErrorsComponent.
4 5 6 7 |
# File 'app/components/railsboot/errors_component.rb', line 4 def initialize(*objects, **html_attributes) @objects = Array(objects) @html_attributes = html_attributes end |
Instance Method Details
#error_messages ⇒ Object
13 14 15 |
# File 'app/components/railsboot/errors_component.rb', line 13 def errors.map(&:full_messages).flatten end |
#errors ⇒ Object
9 10 11 |
# File 'app/components/railsboot/errors_component.rb', line 9 def errors @objects.map(&:errors).flatten end |
#render? ⇒ Boolean
17 18 19 |
# File 'app/components/railsboot/errors_component.rb', line 17 def render? .any? end |