I have model represent association rule (Body => Head)
def Item
has_many :heads
has_many :bodies
...
end
def Rule
has_many :heads
has_many :bodies
...
end
def Body
belongs_to :item
belongs_to :rule
...
end
def Head
belongs_to :item
belongs_to :rule
...
end
I want to find rule that have body s item matched items specified and want to access its head via Rule but I can t do like
def Rule
has_many :heads
has_many :bodies
has_many :item, :through => :heads
has_many :item, :through => :bodies
...
end
What should I change and do to accomplish this ?
Thanks,