Ash FrameworkAF
Ash Frameworkโ€ข2mo agoโ€ข
5 replies
Jesse Williams

Seeding relationships with `seed_generator`?

Is it possible to seed relationships inline with seed_generator?

e.g. something along the lines of

def blog_post(attrs) do
  seed_generator({MyApp.BlogPost, %{}}, overrides: attrs)
end


# in test
owners = generate_many(author())
generate(blog_post(authors: authors))


Seems that belongs_to works OK using thing_id but I'm trying to seed some many_to_manys which doesn't seem to work as I'd expect. The docs I'm finding seem fairly sparse on this sort of thing so I'm really feeling my way around here ๐Ÿ˜…
Was this page helpful?