mongoid-ordering 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mongoid/ordering.rb +9 -5
  2. metadata +12 -12
@@ -206,13 +206,17 @@ module Mongoid
206
206
 
207
207
  def move_lower_siblings_up
208
208
  return if self.ordering_scopes.any? do |scope|
209
- scope_metadata = self.reflect_on_association(scope)
210
- next if scope_metadata.nil?
211
-
212
- relation = send(scope_metadata.name)
209
+ relation = send(scope)
213
210
  next if relation.nil?
214
211
 
215
- relation.flagged_for_destroy? && scope_metadata.inverse_metadata(relation).destructive?
212
+ next unless relation.flagged_for_destroy?
213
+
214
+ inverse_metadata = intelligent_inverse_metadata(scope, relation)
215
+ next if inverse_metadata.nil?
216
+
217
+ inverse_metadata.destructive?
218
+
219
+ # We're testing relation.flagged_for_destroy? && inverse_metadata.destructive?
216
220
  end
217
221
 
218
222
  self.lower_siblings.each { |s| s.inc(:position, -1) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-ordering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
16
- requirement: &70141127517200 !ruby/object:Gem::Requirement
16
+ requirement: &70147814778760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70141127517200
24
+ version_requirements: *70147814778760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mongoid-siblings
27
- requirement: &70141127516720 !ruby/object:Gem::Requirement
27
+ requirement: &70147814778280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 0.1.0
32
+ version: 0.1.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70141127516720
35
+ version_requirements: *70147814778280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70141127516340 !ruby/object:Gem::Requirement
38
+ requirement: &70147814777900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70141127516340
46
+ version_requirements: *70147814777900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70141127515880 !ruby/object:Gem::Requirement
49
+ requirement: &70147814777440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70141127515880
57
+ version_requirements: *70147814777440
58
58
  description: mongoid-ordering makes it easy to keep your Mongoid documents in order.
59
59
  email: douwe@selenight.nl
60
60
  executables: []
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  segments:
86
86
  - 0
87
- hash: -1977126769264338189
87
+ hash: -777469018814037402
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: -1977126769264338189
96
+ hash: -777469018814037402
97
97
  requirements: []
98
98
  rubyforge_project:
99
99
  rubygems_version: 1.8.6