acts_as_ordered_tree 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,8 @@ module ActsAsOrderedTree
33
33
  :class_name => name,
34
34
  :foreign_key => options[:parent_column],
35
35
  :order => options[:position_column],
36
- :inverse_of => (:parent unless options[:polymorphic])
36
+ :inverse_of => (:parent unless options[:polymorphic]),
37
+ :dependent => :destroy
37
38
  }
38
39
 
39
40
  [:before_add, :after_add, :before_remove, :after_remove].each do |callback|
@@ -83,7 +84,7 @@ module ActsAsOrderedTree
83
84
  after_save "move_to_child_with_index(parent, #{position_column})",
84
85
  :if => "#{position_column} && (#{position_column}_changed? || #{parent_column}_changed?)"
85
86
 
86
- before_destroy :destroy_descendants
87
+ before_destroy :flush_descendants
87
88
  after_destroy "decrement_lower_positions(#{parent_column}_was, #{position_column}_was)", :if => position_column
88
89
 
89
90
  # setup validations
@@ -329,9 +329,7 @@ module ActsAsOrderedTree
329
329
  end
330
330
  end
331
331
 
332
- def destroy_descendants #:nodoc:
333
- descendants.delete_all
334
- # flush memoization
332
+ def flush_descendants #:nodoc:
335
333
  @self_and_descendants = nil
336
334
  end
337
335
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsOrderedTree
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_ordered_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-18 00:00:00.000000000 Z
13
+ date: 2012-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  segments:
192
192
  - 0
193
- hash: -557915249
193
+ hash: -3932473491474199545
194
194
  required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  version: '0'
200
200
  segments:
201
201
  - 0
202
- hash: -557915249
202
+ hash: -3932473491474199545
203
203
  requirements: []
204
204
  rubyforge_project: acts_as_ordered_tree
205
205
  rubygems_version: 1.8.24