Class: Formatic::Choices::Keys

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/formatic/choices/keys.rb

Overview

Looks up options for a <select> in i18n.

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/formatic/choices/keys.rb', line 13

def call
  keys.map do |slug|
    caption = ::Formatic::Wrappers::Translate.call(
      prefix: :'helpers.options',
      object: f.object,
      attribute_name: "#{attribute_name}.#{slug}",
      object_name: f&.object_name
    )

    [caption, slug.to_s]
  end
end