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

Version Path
abstracted-0.4.22 app/models/ancestry_abstract_resource.rb
abstracted-0.4.21 app/models/ancestry_abstract_resource.rb
abstracted-0.4.20 app/models/ancestry_abstract_resource.rb
abstracted-0.4.19 app/models/ancestry_abstract_resource.rb
abstracted-0.4.18 app/models/ancestry_abstract_resource.rb
abstracted-0.4.17 app/models/ancestry_abstract_resource.rb
abstracted-0.4.16 app/models/ancestry_abstract_resource.rb
abstracted-0.4.15 app/models/ancestry_abstract_resource.rb
abstracted-0.4.14 app/models/ancestry_abstract_resource.rb
abstracted-0.4.13 app/models/ancestry_abstract_resource.rb
abstracted-0.4.12 app/models/ancestry_abstract_resource.rb
abstracted-0.4.10 app/models/ancestry_abstract_resource.rb
abstracted-0.4.9 app/models/ancestry_abstract_resource.rb
abstracted-0.4.8 app/models/ancestry_abstract_resource.rb
abstracted-0.4.7 app/models/ancestry_abstract_resource.rb
abstracted-0.4.6 app/models/ancestry_abstract_resource.rb
abstracted-0.4.5 app/models/ancestry_abstract_resource.rb
abstracted-0.4.4 app/models/ancestry_abstract_resource.rb
abstracted-0.4.3 app/models/ancestry_abstract_resource.rb
abstracted-0.4.2 app/models/ancestry_abstract_resource.rb