Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Commit

Permalink
fix persisted state while @new_record instance variable not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
saks committed Aug 11, 2010
1 parent be3dbdb commit 7fce729
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mongoid_acts_as_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ def children=(new_children_list)
alias replace children=

def descendants
return [] if new_record?
# workorund for mongoid unexpected behavior
_new_record_var = self.instance_variable_get(:@new_record)
_new_record = _new_record_var != false

return [] if _new_record
self.class.all_in(path_field => [self._id]).order_by tree_order
end

Expand Down

0 comments on commit 7fce729

Please sign in to comment.