Sha256: fd21ace8aa6006a6c6cb5ed3f1a5331427a06dba4b25b509ee9398729a32018b
Contents?: true
Size: 753 Bytes
Versions: 24
Compression:
Stored size: 753 Bytes
Contents
rad.html # Converts {'model[attribute]' => value} into {'model' => {'attribute' => value}} class ScopedParams < Rad::Conveyors::Processor def call if workspace.params? to_delete = [] to_add = {} workspace.params.each do |name, value| name.to_s.scan /(.+)\[(.+)\]/ do |scope_name, name_in_scope| logger.warn "RAD owerriding :#{scope} param!" if workspace.params.include? scope_name scope = to_add[scope_name.to_sym] ||= {} scope[name_in_scope] = value to_delete << name end end workspace.params.merge! to_add to_delete.each{|n| workspace.params.delete n} end next_processor.call end end
Version data entries
24 entries across 24 versions & 1 rubygems