app/helpers/application_helper.rb
#
# Accepts an instance of an ActsAsFamilyTree node and creates a breadcrumb trail from it's ancestors
# Can pass a block for item formatting
#
Accepts an instance of an ActsAsFamilyTree node and creates a breadcrumb trail from it's ancestors
Can pass a block for item formatting
Accepts an instance of an ActsAsFamilyTree node and creates a breadcrumb trail from it ' s ancestors Can pass a block for item formatting
def acts_as_family_tree_breadcrumb(aaft_instance, sep=' &gt; ')
    if aaft_instance.parent.nil?
      grandparent = aaft_instance.all_parent_relations.collect(&:parent_node).detect(&:parent)
      trail = grandparent.nil? ? [aaft_instance] : grandparent.all_parents + [grandparent, aaft_instance]
    else
      trail = aaft_instance.all_parents + [aaft_instance]
    end
    trail.collect do |r|
      block_given? ? yield(r) : r.to_s
    end.join(sep)
  end
def acts_as_family_tree_breadcrumb ( aaft_instance , sep = ' &gt; ' ) if aaft_instance . parent . nil? grandparent = aaft_instance . all_parent_relations . collect ( & :parent_node ) . detect ( & :parent ) trail = grandparent . nil? ? [ aaft_instance ] : grandparent . all_parents + [ grandparent , aaft_instance ] else trail = aaft_instance . all_parents + [ aaft_instance ] end trail . collect do | r | block_given? ? yield ( r ) : r . to_s end . join ( sep ) end
Accepts an instance of an ActsAsFamilyTree node and creates a breadcrumb trail from it's ancestors
Can pass a block for item formatting
Accepts an instance of an ActsAsFamilyTree node and creates a breadcrumb trail from it ' s ancestors Can pass a block for item formatting
aaft_instance
<not_specific>
sep
<not_specific>