Class: ViewComponent::Form::ErrorMessageComponent

Inherits:
FieldComponent show all
Defined in:
app/components/view_component/form/error_message_component.rb

Instance Attribute Summary

Attributes inherited from FieldComponent

#method_name

Attributes inherited from BaseComponent

#form, #object_name, #options

Instance Method Summary collapse

Methods inherited from FieldComponent

#initialize, #label_text, #method_errors, #method_errors?, #object_method_names, #optional?, #required?, #validators, #value

Methods inherited from BaseComponent

#html_class, #initialize, #object_errors, #object_errors?

Methods included from ClassNamesHelper

#build_tag_values, #class_names

Constructor Details

This class inherits a constructor from ViewComponent::Form::FieldComponent

Instance Method Details

#callObject



11
12
13
# File 'app/components/view_component/form/error_message_component.rb', line 11

def call
  tag.public_send(self.class.tag, messages, **options)
end

#messagesObject



19
20
21
# File 'app/components/view_component/form/error_message_component.rb', line 19

def messages
  safe_join(method_errors, tag.br)
end

#render?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/components/view_component/form/error_message_component.rb', line 15

def render?
  method_errors?
end