12
13
14
15
16
17
18
19
20
|
# File 'app/models/purpose/relationship.rb', line 12
def self.included(base)
base.class_eval do
has_many :child_relationships, class_name: 'Purpose::Relationship', foreign_key: :parent_id, dependent: :destroy
has_many :child_purposes, through: :child_relationships, source: :child
has_many :parent_relationships, class_name: 'Purpose::Relationship', foreign_key: :child_id, dependent: :destroy
has_many :parent_purposes, through: :parent_relationships, source: :parent
end
end
|