diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/acts/tree.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/acts/tree.rb b/activerecord/lib/active_record/acts/tree.rb index 5fc7ddf41c..9cf5c3f732 100644 --- a/activerecord/lib/active_record/acts/tree.rb +++ b/activerecord/lib/active_record/acts/tree.rb @@ -71,8 +71,13 @@ module ActiveRecord end define_method(:siblings) do - ( has_parent? ? parent.children : self.class.roots ) - [self] + self_and_siblings - [self] end + + define_method(:self_and_siblings) do + has_parent? ? parent.children : self.class.roots + end + end end end |