Module: FieldInfosHelper

Defined in:
app/helpers/field_infos_helper.rb

Instance Method Summary collapse

Instance Method Details

#field_info_id(path, field) ⇒ Object


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

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


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

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