Module: ActiveFieldsHelper

Defined in:
lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_field_form(active_field) ⇒ Object



26
27
28
# File 'lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb', line 26

def active_field_form(active_field)
  "active_fields/forms/#{active_field.type_name}"
end

#active_value_input(active_field) ⇒ Object



30
31
32
# File 'lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb', line 30

def active_value_input(active_field)
  "active_fields/values/inputs/#{active_field.type_name}"
end

#render_active_field_form(active_field:) ⇒ Object



14
15
16
17
18
# File 'lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb', line 14

def render_active_field_form(active_field:)
  partial = active_field_form(active_field)

  render partial: partial, locals: { active_field: active_field }
end

#render_active_value_input(form:, active_value:) ⇒ Object



20
21
22
23
24
# File 'lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb', line 20

def render_active_value_input(form:, active_value:)
  partial = active_value_input(active_value.active_field)

  render partial: partial, locals: { form: form, active_value: active_value, active_field: active_value.active_field }
end

#render_array_field(form:, name:, value:, field_method:, field_opts: {}) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/generators/active_fields/scaffold/templates/helpers/active_fields_helper.rb', line 4

def render_array_field(form:, name:, value:, field_method:, field_opts: {})
  render partial: "shared/array_field", locals: {
    form: form,
    name: name,
    value: value,
    field_method: field_method,
    field_opts: field_opts,
  }
end