Class: Reform::Form::Populator::External

Inherits:
Object
  • Object
show all
Defined in:
lib/reform/form/populator.rb

Overview

This function is added to the deserializer’s pipeline.

When deserializing, the representer will call this function and thereby delegate the entire population process to the form. The form’s :internal_populator will run its :populator option function and return the new/existing form instance. The deserializing representer will then continue on that returned form.

Goal of this indirection is to leave all population logic in the form, while the representer really just traverses an incoming document and dispatches business logic (which population is) to the form.

Instance Method Summary collapse

Instance Method Details

#call(input, options) ⇒ Object



102
103
104
105
# File 'lib/reform/form/populator.rb', line 102

def call(input, options)
  options[:represented].class.definitions
                       .get(options[:binding][:name])[:internal_populator].(input, options)
end