mm-referenced-tree 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mm-referenced-tree.rb +3 -3
  3. metadata +4 -4
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
 
21
21
  # Change these as appropriate
22
22
  s.name = "mm-referenced-tree"
23
- s.version = "0.1.0"
23
+ s.version = "0.1.1"
24
24
  s.summary = "Yet another tree plugin for MongoMapper, built with an array of reference numbers"
25
25
  s.author = "Richard Livsey"
26
26
  s.email = "richard@livsey.org"
@@ -13,8 +13,8 @@ module MongoMapper
13
13
  write_inheritable_attribute :referenced_tree_options, options
14
14
  class_inheritable_reader :referenced_tree_options
15
15
 
16
- key :reference, Array
17
- key :depth, Integer
16
+ key :reference, Array, :default => [1]
17
+ key :depth, Integer, :default => 1
18
18
 
19
19
  before_create :assign_reference
20
20
  before_create :reposition_subsequent_nodes
@@ -243,7 +243,7 @@ module MongoMapper
243
243
  end
244
244
 
245
245
  def assign_reference
246
- return unless reference.blank?
246
+ return if !new? || reference_changed?
247
247
 
248
248
  if root_node = roots.last
249
249
  self.reference = [root_node.reference[0] + 1]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm-referenced-tree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Livsey
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 +00:00
18
+ date: 2010-11-21 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency