Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Works around a mongoid issue with aggregations and complex conditions…

…. Fixes #34
  • Loading branch information...
commit bc0ef124fb83c620ea496ef22401d98898586eff 1 parent 27fc442
@benedikt authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/mongoid/tree/ordering.rb
View
2  lib/mongoid/tree/ordering.rb
@@ -217,7 +217,7 @@ def assign_default_position
if self.siblings.empty? || self.siblings.collect(&:position).compact.empty?
self.position = 0
else
- self.position = self.siblings.max(:position).to_i + 1
+ self.position = self.siblings.order_by(:position.desc).first.position.to_i + 1
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.