la opción required tiene más prioridad que la definición closes #217

This commit is contained in:
f 2021-02-11 11:49:15 -03:00
parent 12756e3d6a
commit 360b999dcb
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ module ApplicationHelper
# Opciones por defecto para el campo de un formulario # Opciones por defecto para el campo de un formulario
def field_options(attribute, metadata, **extra) def field_options(attribute, metadata, **extra)
required = metadata.required || extra[:required] required = extra.key?(:required) ? extra[:required] : metadata.required
{ {
class: "form-control #{invalid(metadata.post, attribute)} #{extra[:class]}", class: "form-control #{invalid(metadata.post, attribute)} #{extra[:class]}",

View file

@ -32,7 +32,7 @@
= text_field(*field_name_for(base, attribute, :description), = text_field(*field_name_for(base, attribute, :description),
value: metadata.value['description'], value: metadata.value['description'],
dir: dir, lang: locale, dir: dir, lang: locale,
**field_options(attribute, metadata)) **field_options(attribute, metadata, required: false))
= render 'posts/attribute_feedback', = render 'posts/attribute_feedback',
post: post, attribute: [attribute, :description], metadata: metadata post: post, attribute: [attribute, :description], metadata: metadata