Class: Phlexi::Form::Structure::NamespaceCollection

Inherits:
Phlexi::Field::Structure::NamespaceCollection
  • Object
show all
Includes:
ManagesFields
Defined in:
lib/phlexi/form/structure/namespace_collection.rb

Instance Method Summary collapse

Methods included from ManagesFields

#has_file_input!, #has_file_input?

Instance Method Details

#extract_input(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/phlexi/form/structure/namespace_collection.rb', line 9

def extract_input(params)
  namespace = namespaces[0]
  unless namespace
    build_namespace(0)
    @block.call(namespace)
  end

  params = params[key]
  params = params.values if params.is_a?(Hash)
  inputs = Array(params).map { |param| namespace.extract_input([param]) }
  {key => inputs}
end