Sha256: 3a238b4476fa0de35b2699d62528af9dd886b800fb268ef1d3221e1507ba9956
Contents?: true
Size: 646 Bytes
Versions: 1
Compression:
Stored size: 646 Bytes
Contents
class GetFieldTreeListTransaction < Cortex::ApplicationTransaction step :init step :process def init(input) field = Field.find_by_id(input[:args]['field_id']) field ? Right({ content_item: input[:content_item], field: field }) : Left(:not_found) end def process(input) tree_array = input[:field].metadata['allowed_values']['data']['tree_array'] tree_values = input[:content_item].field_items.find {|field_item| field_item.field_id == input[:field].id}.data['values'] tree_list = tree_values.map {|value| tree_array.find {|node| node['id'] == value.to_i}['node']['name']}.join(',') Right(tree_list) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cortex-plugins-core-3.0.0 | app/transactions/get_field_tree_list_transaction.rb |