Class: Formalist::Elements::FormField

Inherits:
ChildForms::ChildForm show all
Defined in:
lib/formalist/elements/form_field.rb

Constant Summary

Constants inherited from ChildForms::ChildForm

ChildForms::ChildForm::DEFAULT_INPUT_PROCESSOR

Instance Attribute Summary

Attributes inherited from Formalist::Element

#attributes, #children, #errors, #input, #name

Instance Method Summary collapse

Methods inherited from ChildForms::ChildForm

#attributes, #form_attribute_ast, #form_input_ast

Methods inherited from Formalist::Element

#==, build, fill, #initialize, #type

Methods included from Formalist::Element::ClassInterface

#attribute, #attributes_schema, #type

Constructor Details

This class inherits a constructor from Formalist::Element

Instance Method Details

#fill(input: {}, errors: {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/formalist/elements/form_field.rb', line 8

def fill(input: {}, errors: {})
  input = input[name]
  errors = errors[name].to_a

  super(input: input, errors: errors)
end

#to_astObject



15
16
17
18
19
20
21
22
# File 'lib/formalist/elements/form_field.rb', line 15

def to_ast
  [:form_field, [
    name,
    type,
    input,
    Element::Attributes.new(attributes).to_ast,
  ]]
end