Sha256: f6f0c93c53ed43d188cdf82c68b822269f0d9113088a4cf7562d6aeb561c6b8b
Contents?: true
Size: 684 Bytes
Versions: 4
Compression:
Stored size: 684 Bytes
Contents
module GOVUKDesignSystemFormBuilder module Elements class ErrorMessage < Base using PrefixableArray include Traits::Error def initialize(builder, object_name, attribute_name) super(builder, object_name, attribute_name) end def html return nil unless has_errors? content_tag('span', class: %(#{brand}-error-message), id: error_id) do safe_join( [ tag.span('Error: ', class: %(#{brand}-visually-hidden)), message ] ) end end def message @builder.object.errors.messages[@attribute_name]&.first end end end end
Version data entries
4 entries across 4 versions & 1 rubygems