Method: FormObj::ModelMapper::ModelAttribute#write_to_model

Defined in:
lib/form_obj/model_mapper/model_attribute.rb

#write_to_model(model, value) ⇒ Object



71
72
73
74
# File 'lib/form_obj/model_mapper/model_attribute.rb', line 71

def write_to_model(model, value)
  model = @items[0..-2].reduce(model) { |last_model, item| item.read_from_model(last_model, create_nested_model_if_nil: true) } if @items.size > 1
  @items.last.write_to_model(model, value)
end