I used rich many to many...
class OwnerRepository < Hanami::Repository
associations do
has_one :avator
has_many :oneships#It's for join table..
has_many :avators,through: :oneships
end
def find_with_avator(id)
aggregate(:avator).where(id: id).map_to(Owner).one
end
def find_with_avators(id)
aggregate(:avators).where(id: id).map_to(Owner).one
#This found one avator but should be found two???
end
end
I create two owners and two avator for each owner,And every owner has two avators with through oneship. But when i want to find avators with given owner_id,Give me one result. In other side Avator Repository works fine.. Why?