lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-v2-0.8.7 vs lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-v2-0.8.8

- old
+ new

@@ -8,15 +8,17 @@ passthrough :other, :other_desc passthrough :data_type embeds_many :options, klass: "Ecoportal::API::V2::Page::Component::SelectionOption", order_key: :weight - def numeric! - data_type = "num" + def numeric!(&block) + ordered_options.each {|opt| opt.numeric!(&block)} + self.data_type = "num" end - def text! - data_type = "str" + def text!(&block) + ordered_options.each {|opt| opt.text!(&block)} + self.data_type = "str" end def select(value) opt = options.find {|opt| opt.value == value} sel = selected