Method: Formbuilder::Entry#response_value

Defined in:
lib/formbuilder/entry.rb

#response_value(response_field) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/formbuilder/entry.rb', line 101

def response_value(response_field)
  value = get_responses[response_field.id.to_s]

  if value
    response_field.serialized ? YAML::load(value) : value
  elsif !value && response_field.serialized && response_field.field_type != 'checkboxes'
    {}
  else # for checkboxes, we need to know the difference between no value and none selected
    nil
  end
end