app/models/option_set.rb
# Given an Option, returns the path down the tree of Options in this set to that Option.
# Returns nil if option not found in set.
Given an Option, returns the path down the tree of Options in this set to that Option.
Returns nil if option not found in set.
Given an Option returns the path down the tree of Options in this set to that Option . Returns nil if option not found in set .
def path_to_option(option)
    node = OptionNode.find_by(option_set: self, option: option)
    return nil if node.nil?
    node.ancestors[1..].map(&:option) + [option]
  end
def path_to_option ( option ) node = OptionNode . find_by ( option_set : self , option : option ) return nil if node . nil? node . ancestors [ 1 .. ] . map ( & :option ) + [ option ] end
Given an Option, returns the path down the tree of Options in this set to that Option.
Given an Option returns the path down the tree of Options in this set to that Option .
# Trim the root node and map to options.
option
<not_specific>