Module: ActiveWarehouse::HierarchicalDimension::InstanceMethods
- Defined in:
- lib/active_warehouse/dimension/hierarchical_dimension.rb
Overview
:nodoc
Instance Method Summary collapse
-
#children ⇒ Object
Get the children for this node.
-
#parent ⇒ Object
Get the parent for this node.
Instance Method Details
#children ⇒ Object
Get the children for this node
51 52 53 54 55 56 |
# File 'lib/active_warehouse/dimension/hierarchical_dimension.rb', line 51 def children self.class.find(:all, :select => "a.*", :joins => "a join #{self.class.bridge_class.table_name} b on a.id = b.child_id", :conditions => ['b.parent_id = ? and b.levels_from_parent = 1', self.id]) end |
#parent ⇒ Object
Get the parent for this node
43 44 45 46 47 48 |
# File 'lib/active_warehouse/dimension/hierarchical_dimension.rb', line 43 def parent self.class.find(:first, :select => "a.*", :joins => "a join #{self.class.bridge_class.table_name} b on a.id = b.parent_id", :conditions => ['b.child_id = ? and b.levels_from_parent = 1', self.id]) end |