Commit d908c1c14d2ced35bbded1dcf4e4524fdef79688
1 parent
c8faf7db
Exists in
master
and in
29 other branches
acts_as_filesystem: add missed methods
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,6 +85,13 @@ module ActsAsFileSystem | ||
85 | end | 85 | end |
86 | end | 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 | # calculates the level of the record in the records hierarchy. Top-level | 95 | # calculates the level of the record in the records hierarchy. Top-level |
89 | # records have level 0; the children of the top-level records have | 96 | # records have level 0; the children of the top-level records have |
90 | # level 1; the children of records with level 1 have level 2, and so on. | 97 | # level 1; the children of records with level 1 have level 2, and so on. |