Class: Rules::PopulateDropDown
- Defined in:
- lib/question_chain/models/rules/populate_drop_down.rb
Class Method Summary collapse
Instance Method Summary collapse
- #drop_down_target_id ⇒ Object
- #fire!(value = nil, ui_objects_hash = {}) ⇒ Object
-
#get_options(object_ids = []) ⇒ Object
ask the parent document to get the options.
Methods inherited from Rule
Class Method Details
.attributes_for_api ⇒ Object
25 26 27 |
# File 'lib/question_chain/models/rules/populate_drop_down.rb', line 25 def self.attributes_for_api %w(id fire_value _type ui_object_id drop_down_target_id ui_object_attribute_check negate_value) end |
Instance Method Details
#drop_down_target_id ⇒ Object
12 13 14 |
# File 'lib/question_chain/models/rules/populate_drop_down.rb', line 12 def drop_down_target_id _parent_document.drop_down_target_id end |
#fire!(value = nil, ui_objects_hash = {}) ⇒ Object
7 8 9 10 |
# File 'lib/question_chain/models/rules/populate_drop_down.rb', line 7 def fire!(value = nil, ui_objects_hash = {}) # does not matter what the value is in this instance # it is used to get opions for the drop_down_target end |
#get_options(object_ids = []) ⇒ Object
ask the parent document to get the options
17 18 19 20 21 22 23 |
# File 'lib/question_chain/models/rules/populate_drop_down.rb', line 17 def (object_ids = []) = [] _parent_document.(object_ids).each_pair do |key ,value| << {:name => value, :value => key} end .sort_by{|option| option[:name]} end |