class Frigate::Form::Synchronizer::Form::ParamsToPropertiesSynchronizer

It's just extracted method sync_properties_with_model_or_params into this class

Public Instance Methods

sync_params_with_properties(params) click to toggle source

Synchronizes given params with form properties and associations:properties @param [Hash] params

# File lib/frigate/form/synchronizer/form.rb, line 11
def sync_params_with_properties(params)
        process_params(params, form)
end

Private Instance Methods

process_params(params, ctx) click to toggle source
# File lib/frigate/form/synchronizer/form.rb, line 17
def process_params(params, ctx)
        params.each do |_p_n, _p_v|
                if _p_v.is_a?(Hash)
                        process_params(_p_v, ctx.send(_p_n.to_sym))
                else
                        sync_properties(_p_n, _p_v, ctx)
                end
        end
end
sync_properties(p_n, p_v, ctx) click to toggle source
# File lib/frigate/form/synchronizer/form.rb, line 27
def sync_properties(p_n, p_v, ctx)
        ctx.properties.each { |_p| _p.value = p_v if p_n.to_sym == _p.name.to_sym }
end