dm-is-nested_set 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.9.9 / 2009-01-04
2
+
3
+ * 1 bug fix:
4
+
5
+ * Fixed to work with Models using STI
6
+
1
7
  === 0.9.8 / 2008-12-07
2
8
 
3
9
  * No changes this version
@@ -115,7 +115,7 @@ module DataMapper
115
115
  #
116
116
  # @private
117
117
  def nested_set_scope
118
- self.class.nested_set_scope.map{|p| [p,attribute_get(p)]}.to_hash
118
+ self.model.base_model.nested_set_scope.map{|p| [p,attribute_get(p)]}.to_hash
119
119
  end
120
120
 
121
121
  ##
@@ -123,7 +123,7 @@ module DataMapper
123
123
  # @private
124
124
  def original_nested_set_scope
125
125
  # TODO commit
126
- self.class.nested_set_scope.map{|p| [p, original_values.key?(p) ? original_values[p] : attribute_get(p)]}.to_hash
126
+ self.model.base_model.nested_set_scope.map{|p| [p, original_values.key?(p) ? original_values[p] : attribute_get(p)]}.to_hash
127
127
  end
128
128
 
129
129
  ##
@@ -131,7 +131,7 @@ module DataMapper
131
131
  #
132
132
  def nested_set
133
133
  # TODO add option for serving it as a nested array
134
- self.class.all(nested_set_scope.merge(:order => [:lft.asc]))
134
+ self.model.base_model.all(nested_set_scope.merge(:order => [:lft.asc]))
135
135
  end
136
136
 
137
137
  ##
@@ -211,16 +211,16 @@ module DataMapper
211
211
  # find out how wide this node is, as we need to make a gap large enough for it to fit in
212
212
  gap = self.rgt - self.lft + 1
213
213
  # make a gap at position, that is as wide as this node
214
- self.class.adjust_gap!(nested_set,position-1,gap)
214
+ self.model.base_model.adjust_gap!(nested_set,position-1,gap)
215
215
  # offset this node (and all its descendants) to the right position
216
216
  old_position = self.lft
217
217
  offset = position - old_position
218
218
  nested_set.all(:rgt => self.lft..self.rgt).adjust!({:lft => offset, :rgt => offset},true)
219
219
  # close the gap this movement left behind.
220
- self.class.adjust_gap!(nested_set,old_position,-gap)
220
+ self.model.base_model.adjust_gap!(nested_set,old_position,-gap)
221
221
  else
222
222
  # make a gap where the new node can be inserted
223
- self.class.adjust_gap!(nested_set,position-1,2)
223
+ self.model.base_model.adjust_gap!(nested_set,position-1,2)
224
224
  # set the position fields
225
225
  self.lft, self.rgt = position, position + 1
226
226
  end
@@ -359,7 +359,7 @@ module DataMapper
359
359
  private
360
360
  def detach
361
361
  offset = self.lft - self.rgt - 1
362
- self.class.adjust_gap!(nested_set,self.rgt,offset)
362
+ self.model.base_model.adjust_gap!(nested_set,self.rgt,offset)
363
363
  self.lft,self.rgt = nil,nil
364
364
  end
365
365
 
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module Is
3
3
  module NestedSet
4
- VERSION = '0.9.8'
4
+ VERSION = '0.9.9'
5
5
  end
6
6
  end
7
7
  end
@@ -1,10 +1,10 @@
1
1
  require 'pathname'
2
2
  require 'rubygems'
3
3
 
4
- gem 'dm-core', '~>0.9.8'
4
+ gem 'dm-core', '~>0.9.9'
5
5
  require 'dm-core'
6
6
 
7
- #gem 'dm-adjust', '~>0.9.8'
7
+ #gem 'dm-adjust', '~>0.9.9'
8
8
  require 'dm-adjust'
9
9
 
10
10
  require Pathname(__FILE__).dirname.expand_path / 'dm-is-nested_set' / 'is' / 'nested_set'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-is-nested_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sindre Aarsaether
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-07 00:00:00 -08:00
12
+ date: 2009-01-04 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.8
23
+ version: 0.9.9
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: dm-adjust
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.8
33
+ version: 0.9.9
34
34
  version:
35
35
  description: DataMapper plugin allowing the creation of nested sets from data models
36
36
  email: