Ash FrameworkAF
Ash Framework3y ago
9 replies
Robert Graff

How do relationships with composite keys work?

I found this mention of composite keys in the docs:
  has_many :composite_key_posts, MyApp.CompositeKeyPost do
    destination_attribute :author_id
  end


Ideally I need something like:
belongs_to :widget, MyApp.Widget do 
   source_attribute: [:scope_key, :source_key]
   destination_attribute: [:scope_key, :destination_key]
end


A similar effect to have scope_key being a tenant.
Was this page helpful?