Module: StaticList::Helpers

Defined in:
lib/static_list.rb

Instance Method Summary collapse

Instance Method Details

#static_list_select_options(static_object) ⇒ Object

Localizes all the static codes for select options helper

Example : f.select :hair_color, static_list_select_options(HairColor)



102
103
104
# File 'lib/static_list.rb', line 102

def static_list_select_options(static_object)
  static_object.static_list_codes.map { |code| [t_static_list(code[1], static_object), code[1]] }
end

#t_static_list(code, static_object) ⇒ Object

Localizes a static code For example : t_static_list(@user.hair_color, HairColor)

will read the key hair_color.white



92
93
94
95
# File 'lib/static_list.rb', line 92

def t_static_list(code, static_object)
  return unless code
  t(static_object.t_key_from_code(code))
end