Class: DynamicScaffold::Form::Item::JSONObject
- Defined in:
- lib/dynamic_scaffold/form/item/json_object.rb
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Attributes inherited from Base
#multiple, #name, #parent_item
Instance Method Summary collapse
- #extract_parameters(permitting) ⇒ Object
-
#initialize(config, type, name, options = {}) {|@form| ... } ⇒ JSONObject
constructor
A new instance of JSONObject.
-
#render_label(_view, _depth) ⇒ Object
the lable is always empty.
Methods inherited from Base
create, #default, #default_value, #errors, #if, #insert, #label, #label?, #needs_rendering?, #note, #notes?, #proxy, #proxy_field, #render_notes, #type?, #unique_name, #unless
Constructor Details
#initialize(config, type, name, options = {}) {|@form| ... } ⇒ JSONObject
Returns a new instance of JSONObject.
6 7 8 9 10 11 12 |
# File 'lib/dynamic_scaffold/form/item/json_object.rb', line 6 def initialize(config, type, name, = {}) super = @form = FormBuilder.new(config) @form.parent_item = self yield(@form) end |
Instance Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
5 6 7 |
# File 'lib/dynamic_scaffold/form/item/json_object.rb', line 5 def form @form end |
Instance Method Details
#extract_parameters(permitting) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dynamic_scaffold/form/item/json_object.rb', line 19 def extract_parameters(permitting) hash = permitting.find {|e| e.is_a?(Hash) && e.key?(name) } if hash.nil? hash = {} hash[name] = form.items.map(&:name) permitting << hash else hash[name].concat(form.items.map(&:name)) end end |
#render_label(_view, _depth) ⇒ Object
the lable is always empty.
15 16 17 |
# File 'lib/dynamic_scaffold/form/item/json_object.rb', line 15 def render_label(_view, _depth) '' end |