Skip to content

Commit ee945b0

Browse files
committed
faster ancestry_path method
- reversing array of strings is faster than reversing array of ActiveRecord models
1 parent e328f1a commit ee945b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/closure_tree/model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def self_and_ancestors_ids
9797
# to the +name_column+.
9898
# (so child.ancestry_path == +%w{grandparent parent child}+
9999
def ancestry_path(to_s_column = _ct.name_column)
100-
self_and_ancestors.reverse.map { |n| n.send to_s_column.to_sym }
100+
self_and_ancestors.map { |n| n.send to_s_column.to_sym }.reverse
101101
end
102102

103103
def child_ids

0 commit comments

Comments
 (0)