module ThroughHierarchy::Base::ClassMethods
Public Instance Methods
inherited(child)
click to toggle source
deep_dup these class attributes on inheritance so we can safely use in-place modifiers
Calls superclass method
# File lib/through_hierarchy/base.rb, line 22 def inherited(child) child.hierarchical_associations = self.hierarchical_associations.deep_dup super end
joins_through_hierarchy(name)
click to toggle source
# File lib/through_hierarchy/base.rb, line 31 def joins_through_hierarchy(name) hierarchical_associations.key?(name) or raise ThroughHierarchyAssociationMissingError, "No association named #{name} was found. Perhaps you misspelled it?" hierarchical_associations[name].join end
through_hierarchy(members, &blk)
click to toggle source
# File lib/through_hierarchy/base.rb, line 27 def through_hierarchy(members, &blk) Hierarchy.new(self, members).instance_eval(&blk) end