Class: Locomotive::API::Forms::EditableElementForm

Inherits:
BaseForm
  • Object
show all
Defined in:
app/api/locomotive/api/forms/editable_element_form.rb

Constant Summary collapse

TYPES =
%w(file text control)

Instance Attribute Summary

Attributes inherited from BaseForm

#_persisted, #_policy

Instance Method Summary collapse

Methods inherited from BaseForm

attributes, attrs, define_attribute, #persisted?, #serializable_hash, #set_attribute

Instance Method Details

#_type=(type) ⇒ Object



24
25
26
27
# File 'app/api/locomotive/api/forms/editable_element_form.rb', line 24

def _type=(type)
  return unless TYPES.include?(type.to_s)
  set_attribute :_type, "Locomotive::Editable#{type.to_s.classify}"
end

#content=(value) ⇒ Object



16
17
18
19
20
21
22
# File 'app/api/locomotive/api/forms/editable_element_form.rb', line 16

def content=(value)
  if is_file?(value)
    self._type = :file
  end

  set_attribute :content, value
end