19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/enum_translate/enum_translate_concern.rb', line 19
def human_attribute_options(attribute_name)
attribute_values = public_send(attribute_name.to_s.pluralize)
raise EnumTranslateArgumentError, "#{name}.#{attribute_name} should be Hash-type value." unless attribute_values.is_a?(Hash)
option_values_hash = I18n.t "activerecord.attributes.#{name.underscore}/#{attribute_name}", default: attribute_values
attribute_values.keys.map { |attribute_value| [option_values_hash[attribute_value.intern], attribute_value] }
end
|