Revision history for DBIx::Class::Tree
+ - Optimized is_leaf to not trigger another query if the children
+ releationship is prefetched
+
0.03002 2010-09-23
- Added various docs
- Added ordered ancesors (nebulous)
sub is_leaf {
my( $self ) = @_;
- my $has_child = $self->result_source->resultset->search(
- { $self->_parent_column => $self->id() },
- { limit => 1 }
- )->count();
+ my $has_child = $self->children_rs->count();
return $has_child ? 0 : 1;
}