@@ -203,6 +203,8 module ActionController | |||||
203 | end |
|
203 | end | |
204 | end |
|
204 | end | |
205 |
|
205 | |||
|
206 | require 'awesome_nested_set/version' | |||
|
207 | ||||
206 | module CollectiveIdea |
|
208 | module CollectiveIdea | |
207 | module Acts |
|
209 | module Acts | |
208 | module NestedSet |
|
210 | module NestedSet | |
@@ -211,6 +213,23 module CollectiveIdea | |||||
211 | new_record? || leaf_without_new_record? |
|
213 | new_record? || leaf_without_new_record? | |
212 | end |
|
214 | end | |
213 | alias_method_chain :leaf?, :new_record |
|
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 | end |
|
233 | end | |
215 | end |
|
234 | end | |
216 | end |
|
235 | end |
@@ -593,8 +593,6 module CollectiveIdea #:nodoc: | |||||
593 | ["#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)", diff] |
|
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 | # Don't allow multiple calls to destroy to corrupt the set |
|
596 | # Don't allow multiple calls to destroy to corrupt the set | |
599 | self.skip_before_destroy = true |
|
597 | self.skip_before_destroy = true | |
600 | end |
|
598 | end |
General Comments 0
You need to be logged in to leave comments.
Login now