noosfero | acts_as_filesystem: add missed methods

Bráulio Bhavamitra gitlab at gitlab.com
Tue Mar 3 19:08:33 BRT 2015


Bráulio Bhavamitra pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/d908c1c14d2ced35bbded1dcf4e4524fdef79688">d908c1c1</a> by Braulio Bhavamitra
acts_as_filesystem: add missed methods

- - - - -


Changes:

=====================================
lib/acts_as_filesystem.rb
=====================================
--- 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150303/bf7cecb1/attachment.html>


More information about the Noosfero-dev mailing list