Class: Viewable::Form

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Admin::Viewable::Form, Viewable, Viewable::Field::UUID, Viewable::Field::Url, Splitter
Defined in:
app/models/viewable/form.rb

Defined Under Namespace

Modules: Splitter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Viewable::Field::UUID

#other_uuid, #uuid, #uuid_with

Methods included from Viewable

#list, #other_locales, #unique_key_hash

Class Method Details

.not_static?(name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/viewable/form.rb', line 20

def not_static?(name)
  !static?(name)
end

.static?(name) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/viewable/form.rb', line 16

def static?(name)
  name.in? Naming::Viewable::Form.static_names
end

Instance Method Details

#fetch_row(form) ⇒ Object



37
38
39
40
41
42
43
44
# File 'app/models/viewable/form.rb', line 37

def fetch_row(form)
  if structure.nil?
    create_structure!(viewable: self, email: ::Form::Email.new)
  end
  attributes = form.attributes
  attributes['structure_id'] = structure_id
  rows.build(attributes)
end

#form_nameObject



25
26
27
# File 'app/models/viewable/form.rb', line 25

def form_name
  @_form_name ||= view_path.split('/')[-2]
end

#not_static?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/models/viewable/form.rb', line 33

def not_static?
  !static?
end

#static?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/models/viewable/form.rb', line 29

def static?
  form_name.in? Naming::Viewable::Form.static_names
end