Composite primary keys vs through

It looks like destination/source_attribute_on_join_resource both expect an atom. Is it possible to reference a composite key on a join table? I am trying to set up a many_to_many relationship.
Solution:
But you can use a has_many with a filter
Jump to solution
6 Replies
ZachDaniel
ZachDaniel7d ago
Can you be more specific about the fields/relationships you're trying to set up?
Songyun
SongyunOP7d ago
Was looking into a ExtOrg (external organization) and User many_to_many relationship but the ExtOrg has a composite primary key for uniqueness (platform + ext id). I can use an identity instead potentially to enforce that, but this is was sort of a "could I do this?" situation
ZachDaniel
ZachDaniel7d ago
Ah, yeah I don't think you reasonably can do it with many_to_many
Solution
ZachDaniel
ZachDaniel7d ago
But you can use a has_many with a filter
ZachDaniel
ZachDaniel7d ago
Search for Rebecca Le's blog post about relationships with filters in ash
Songyun
SongyunOP7d ago
Modelling through relationships with Ash | sevenseacat.net
They're not natively supported, but you can still make them!

Did you find this page helpful?