Commit d908c1c14d2ced35bbded1dcf4e4524fdef79688

Authored by Braulio Bhavamitra
1 parent c8faf7db

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 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.
... ...