Commit 04fc56782b6a7f6ec5a36f8833562ea025bf671e
Exists in
master
and in
27 other branches
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
lib/acts_as_filesystem.rb
| ... | ... | @@ -85,6 +85,13 @@ module ActsAsFileSystem |
| 85 | 85 | end |
| 86 | 86 | end |
| 87 | 87 | |
| 88 | + def descendents_options | |
| 89 | + ["#{self.ancestry_column} LIKE ?", "%#{self.formatted_ancestry_id}%"] | |
| 90 | + end | |
| 91 | + def descendents | |
| 92 | + self.class.scoped :conditions => descendents_options | |
| 93 | + end | |
| 94 | + | |
| 88 | 95 | # calculates the level of the record in the records hierarchy. Top-level |
| 89 | 96 | # records have level 0; the children of the top-level records have |
| 90 | 97 | # level 1; the children of records with level 1 have level 2, and so on. | ... | ... |