mongoid-tree 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mongoid/tree/ordering.rb +1 -1
- data/spec/mongoid/tree_spec.rb +1 -1
- metadata +2 -2
|
@@ -217,7 +217,7 @@ module Mongoid
|
|
|
217
217
|
if self.siblings.empty? || self.siblings.collect(&:position).compact.empty?
|
|
218
218
|
self.position = 0
|
|
219
219
|
else
|
|
220
|
-
self.position = self.siblings.
|
|
220
|
+
self.position = self.siblings.order_by(:position.desc).first.position.to_i + 1
|
|
221
221
|
end
|
|
222
222
|
end
|
|
223
223
|
end
|
data/spec/mongoid/tree_spec.rb
CHANGED
|
@@ -10,7 +10,7 @@ describe Mongoid::Tree do
|
|
|
10
10
|
a.macro.should eql(:has_many)
|
|
11
11
|
a.class_name.should eql('Node')
|
|
12
12
|
a.foreign_key.should eql('parent_id')
|
|
13
|
-
Node.index_options.should have_key(
|
|
13
|
+
Node.index_options.should have_key(:parent_id => 1)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "should be referenced in one parent as inverse of children" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid-tree
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mongoid
|