mongoid-tree 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.max(:position).to_i + 1
220
+ self.position = self.siblings.order_by(:position.desc).first.position.to_i + 1
221
221
  end
222
222
  end
223
223
  end
@@ -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('parent_id' => 1)
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.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-07-14 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid