Class: Railsboot::ErrorsComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/errors_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(*objects, **html_attributes) ⇒ ErrorsComponent

Returns a new instance of ErrorsComponent.



2
3
4
5
# File 'app/components/railsboot/errors_component.rb', line 2

def initialize(*objects, **html_attributes)
  @objects = Array(objects)
  @html_attributes = html_attributes
end

Instance Method Details

#error_messagesObject



11
12
13
# File 'app/components/railsboot/errors_component.rb', line 11

def error_messages
  errors.map(&:full_messages).flatten
end

#errorsObject



7
8
9
# File 'app/components/railsboot/errors_component.rb', line 7

def errors
  @objects.map(&:errors).flatten
end

#render?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/components/railsboot/errors_component.rb', line 15

def render?
  error_messages.any?
end