diff --git a/lib/acts_as_filesystem.rb b/lib/acts_as_filesystem.rb index b9bae29..1db6b68 100644 --- a/lib/acts_as_filesystem.rb +++ b/lib/acts_as_filesystem.rb @@ -85,6 +85,13 @@ module ActsAsFileSystem end end + def descendents_options + ["#{self.ancestry_column} LIKE ?", "%#{self.formatted_ancestry_id}%"] + end + def descendents + self.class.scoped :conditions => descendents_options + end + # calculates the level of the record in the records hierarchy. Top-level # records have level 0; the children of the top-level records have # level 1; the children of records with level 1 have level 2, and so on. -- libgit2 0.21.2