Sha256: 8d2d137177dd150db22790ac0b7dfad427f66efda56e9ca534ae64dd0d6aadbb
Contents?: true
Size: 702 Bytes
Versions: 3
Compression:
Stored size: 702 Bytes
Contents
# prepopulate!(options) # prepopulator: ->(model, user_options) module Reform::Form::Prepopulate def prepopulate!(options = {}) prepopulate_local!(options) # call #prepopulate! on local properties. prepopulate_nested!(options) # THEN call #prepopulate! on nested forms. self end private def prepopulate_local!(options) schema.each do |dfn| next unless block = dfn[:prepopulator] ::Representable::Option(block).(exec_context: self, keyword_arguments: options) end end def prepopulate_nested!(options) schema.each(twin: true) do |dfn| Disposable::Twin::PropertyProcessor.new(dfn, self).() { |form| form.prepopulate!(options) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reform-2.6.2 | lib/reform/form/prepopulate.rb |
reform-2.6.1 | lib/reform/form/prepopulate.rb |
reform-2.6.0 | lib/reform/form/prepopulate.rb |