module Sunrise::Models::Structure::ClassMethods

Public Instance Methods

nested_set_options(mover = nil) { |i| ... } click to toggle source
# File lib/sunrise/models/structure.rb, line 31
def nested_set_options(mover = nil)
  result = []

  roots.each do |root|
    result += root.self_and_descendants.map do |i|
      [yield(i), i.id] if mover.nil? || mover.new_record? || mover.move_possible?(i)
    end.compact
  end
  result
end