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
38 39 40 |
# File 'lib/custom_fields/types/select.rb', line 38 def self..sort { |a, b| (a.position || 0) <=> (b.position || 0) }.to_a end |
#select_as_json(options = {}) ⇒ Object
50 51 52 |
# File 'lib/custom_fields/types/select.rb', line 50 def select_as_json( = {}) { 'select_options' => self..map(&:as_json) } end |
#select_to_recipe ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/custom_fields/types/select.rb', line 42 def select_to_recipe { 'select_options' => self..map do |option| { '_id' => option._id, 'name' => option.name_translations } end } end |