Class: Rectify::FormAttribute

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/rectify/form_attribute.rb

Instance Method Summary collapse

Instance Method Details

#value_from(model_value) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/rectify/form_attribute.rb', line 3

def value_from(model_value)
  return declared_class.from_model(model_value) if form_object?

  if collection_of_form_objects?
    return model_value.map { |child| element_class.from_model(child) }
  end

  model_value
end