ramdiv-mongo_mapper_acts_as_tree 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -49,6 +49,7 @@ module MongoMapper
49
49
  end
50
50
 
51
51
  def parent=(var)
52
+ self[parent_id_field] = nil if var.nil?
52
53
  var = search_class.find(var) if var.is_a? String
53
54
 
54
55
  if self.descendants.include? var
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ramdiv-mongo_mapper_acts_as_tree}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakob Vidmar"]
12
- s.date = %q{2010-07-03}
12
+ s.date = %q{2010-10-07}
13
13
  s.description = %q{Port of the old, venerable ActsAsTree with a bit of a twist}
14
14
  s.email = %q{jakob.vidmar@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -125,6 +125,16 @@ class TestMongomapperActsAsTree < Test::Unit::TestCase
125
125
  @root_1.parent = @child_2_1
126
126
  assert !@root_1.save
127
127
  end
128
+
129
+ should "be able to become root" do
130
+ @child_2.parent = nil
131
+ @child_2.save
132
+ @child_2.reload
133
+ assert_nil @child_2.parent
134
+ @child_2_1.reload
135
+ assert (@child_2_1.path == [@child_2.id])
136
+ end
137
+
128
138
  end
129
139
 
130
140
  should "destroy descendants when destroyed" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jakob Vidmar
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-03 00:00:00 +02:00
17
+ date: 2010-10-07 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency