Module: FieldInfosHelper

Defined in:
app/helpers/field_infos_helper.rb

Instance Method Summary collapse

Instance Method Details

#field_info_id(path, field) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/helpers/field_infos_helper.rb', line 3

def field_info_id(path, field)
  path = path.clone
  return field if path.empty?

  first = path.shift
  to_bracketize = path + [field.key] # , "value"]
  to_join = [first] + to_bracketize.map { |w| "[#{w}]" }
  to_join.join
end

#field_info_label(path, field) ⇒ Object



13
14
15
# File 'app/helpers/field_infos_helper.rb', line 13

def field_info_label(path, field)
  (path + [field.key]).join('_')
end