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)
Instance Method Details
#sync! ⇒ Object
reading from fields allows using readers in form for presentation and writers still pass to fields in #validate????
51 52 53 54 55 56 57 58 59 |
# File 'lib/reform/form/sync.rb', line 51 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) # sync properties to Song. model end |
#sync_models ⇒ Object Also known as: sync
44 45 46 |
# File 'lib/reform/form/sync.rb', line 44 def sync_models sync! end |