Sha256: bcade1e49d1f8cee6b4fa82ce4ece1225f58e4ab9dc7b342d4f29f0602adef6c
Contents?: true
Size: 588 Bytes
Versions: 36
Compression:
Stored size: 588 Bytes
Contents
class AncestryAbstractResource < AbstractResource self.abstract_class=true # # provided for ancestry 'polluted' tables ;) # # children and subtree are special ancestry related methods # # # # # def self.arraying(options={}, hash=nil) hash ||= arrange(options) arr = [] hash.each do |node, children| arr << node arr += arraying(options, children) unless children.nil? end arr end def possible_parents order='name' parents = self.arraying( order: order) return new_record? ? parents : parents - subtree end # # # # # end
Version data entries
36 entries across 36 versions & 1 rubygems