Module: CustomFields::Types::Select::Field
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/custom_fields/types/select.rb
Instance Method Summary collapse
Instance Method Details
#ordered_select_options ⇒ Object
32 33 34 |
# File 'lib/custom_fields/types/select.rb', line 32 def .sort { |a, b| (a.position || 0) <=> (b.position || 0) }.to_a end |
#select_as_json(_options = {}) ⇒ Object
44 45 46 |
# File 'lib/custom_fields/types/select.rb', line 44 def select_as_json( = {}) { 'select_options' => .map(&:as_json) } end |
#select_to_recipe ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/custom_fields/types/select.rb', line 36 def select_to_recipe { 'select_options' => .map do |option| { '_id' => option._id, 'name' => option.name_translations } end } end |