@@ -203,6 +203,8 module ActionController | |||
|
203 | 203 | end |
|
204 | 204 | end |
|
205 | 205 | |
|
206 | require 'awesome_nested_set/version' | |
|
207 | ||
|
206 | 208 | module CollectiveIdea |
|
207 | 209 | module Acts |
|
208 | 210 | module NestedSet |
@@ -211,6 +213,23 module CollectiveIdea | |||
|
211 | 213 | new_record? || leaf_without_new_record? |
|
212 | 214 | end |
|
213 | 215 | alias_method_chain :leaf?, :new_record |
|
216 | # Reload is needed because children may have updated | |
|
217 | # their parent (self) during deletion. | |
|
218 | if ::AwesomeNestedSet::VERSION > "2.1.6" | |
|
219 | module Prunable | |
|
220 | def destroy_descendants_with_reload | |
|
221 | destroy_descendants_without_reload | |
|
222 | reload | |
|
223 | end | |
|
224 | alias_method_chain :destroy_descendants, :reload | |
|
225 | end | |
|
226 | else | |
|
227 | def destroy_descendants_with_reload | |
|
228 | destroy_descendants_without_reload | |
|
229 | reload | |
|
230 | end | |
|
231 | alias_method_chain :destroy_descendants, :reload | |
|
232 | end | |
|
214 | 233 | end |
|
215 | 234 | end |
|
216 | 235 | end |
@@ -593,8 +593,6 module CollectiveIdea #:nodoc: | |||
|
593 | 593 | ["#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)", diff] |
|
594 | 594 | ) |
|
595 | 595 | |
|
596 | # Reload is needed because children may have updated their parent (self) during deletion. | |
|
597 | reload | |
|
598 | 596 | # Don't allow multiple calls to destroy to corrupt the set |
|
599 | 597 | self.skip_before_destroy = true |
|
600 | 598 | end |
General Comments 0
You need to be logged in to leave comments.
Login now