Module: Reform::Form::Sync
- Included in:
- Reform::Form
- Defined in:
- lib/reform/form/sync.rb
Overview
#sync!
1. assign scalars to model (respecting virtual, excluded attributes)
2. call sync! on nested
Defined Under Namespace
Modules: InputRepresenter, Writer
Instance Method Summary collapse
-
#sync! ⇒ Object
reading from fields allows using readers in form for presentation and writers still pass to fields in #validate????.
-
#sync_models ⇒ Object
(also: #sync)
TODO: add ToHash with :prepare => lambda { |form, args| form },.
Instance Method Details
#sync! ⇒ Object
reading from fields allows using readers in form for presentation and writers still pass to fields in #validate????
54 55 56 57 58 59 60 |
# File 'lib/reform/form/sync.rb', line 54 def sync! # semi-public. input_representer = mapper.new(fields).extend(InputRepresenter) input = input_representer.to_hash mapper.new(aliased_model).extend(Writer).from_hash(input) end |
#sync_models ⇒ Object Also known as: sync
TODO: add ToHash with :prepare => lambda { |form, args| form },
47 48 49 |
# File 'lib/reform/form/sync.rb', line 47 def sync_models sync! end |