From d908c1c14d2ced35bbded1dcf4e4524fdef79688 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Tue, 3 Mar 2015 19:04:24 -0300 Subject: [PATCH] acts_as_filesystem: add missed methods --- lib/acts_as_filesystem.rb | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) 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