module CustomFields::Types::Select::Field
Public Instance Methods
ordered_select_options()
click to toggle source
# File lib/custom_fields/types/select.rb, line 32 def ordered_select_options select_options.sort { |a, b| (a.position || 0) <=> (b.position || 0) }.to_a end
select_as_json(_options = {})
click to toggle source
# File lib/custom_fields/types/select.rb, line 44 def select_as_json(_options = {}) { 'select_options' => ordered_select_options.map(&:as_json) } end
select_to_recipe()
click to toggle source
# File lib/custom_fields/types/select.rb, line 36 def select_to_recipe { 'select_options' => ordered_select_options.map do |option| { '_id' => option._id, 'name' => option.name_translations } end } end