Class: Bp3::Formtastic::VizFormBuilderWithCreate

Inherits:
VizFormBuilder
  • Object
show all
Defined in:
lib/bp3/formtastic/viz_form_builder_with_create.rb

Instance Attribute Summary

Attributes inherited from VizFormBuilder

#vizfacts

Instance Method Summary collapse

Methods inherited from VizFormBuilder

#initialize, #input, #input_control_class, #load_vizfacts, #vizfact_attrs

Constructor Details

This class inherits a constructor from Bp3::Formtastic::VizFormBuilder

Instance Method Details

#create_input_control_record(element_name, element_ident) ⇒ Object (private)



17
18
19
20
# File 'lib/bp3/formtastic/viz_form_builder_with_create.rb', line 17

def create_input_control_record(element_name, element_ident)
  attrs = vizfact_attrs(element_name, element_ident)
  Vizfact::Input.unscoped.create!(attrs)
end

#viz(element_name, element_ident) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/bp3/formtastic/viz_form_builder_with_create.rb', line 6

def viz(element_name, element_ident)
  return if vizfacts.nil?

  record = super
  return record if record

  create_input_control_record(element_name, element_ident)
end