Class: Pwb::FieldKey
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pwb::FieldKey
- Defined in:
- app/models/pwb/field_key.rb
Overview
A FieldKey records the translation key that is used by a field such as propType
Class Method Summary collapse
-
.get_options_by_tag(tag) ⇒ Object
below is used to get values to populate dropdowns in search forms.
Class Method Details
.get_options_by_tag(tag) ⇒ Object
below is used to get values to populate dropdowns in search forms
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/pwb/field_key.rb', line 20 def self.(tag) = [] translation_keys = FieldKey.where(tag: tag).visible.pluck("global_key") translation_keys.each do |option_key| option = OpenStruct.new option.value = option_key option.label = I18n.t option_key .push option end .sort_by { |r| r.label.downcase } end |