Module: ClosureTree::HashTree
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/closure_tree/hash_tree.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#hash_tree(options = {}) ⇒ Object
14 15 16 |
# File 'lib/closure_tree/hash_tree.rb', line 14 def hash_tree( = {}) self.class.build_hash_tree(hash_tree_scope([:limit_depth])) end |
#hash_tree_scope(limit_depth = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/closure_tree/hash_tree.rb', line 5 def hash_tree_scope(limit_depth = nil) scope = self_and_descendants if limit_depth scope.where("#{_ct.quoted_hierarchy_table_name}.generations <= #{limit_depth - 1}") else scope end end |