Idiomatic way to model insert of list of values using Ash

Wondering if there is a best practice for inserting a list of values into a single column in Ash (without using multiple tables and relationships). In other words, to insert a list of atoms (e.g. [:one, :two, :three]) into a single column.

There are a few tantalizing hints in the Ash Hexdocs (references to a vector type and some partial examples referencing :array types).

Alternatively, using JSON or something like that seems pretty heavy.

attribute :foo, {:array, <type>} should be what you’re looking for :slight_smile:

Awesome, thank you @zachdaniel … I’ll have to take another look, but I don’t recall finding particularly good docs on this – would be delightful to see it added to the quick start or perhaps on the Attributes page. Or better yet… perhaps a guide page on types in general.

1 Like

Agreed, I think we take advantage of the fact that many users come from Ecto and had experience w/ that particular construction and Ecto.Type, which Ash.Type is based off of. So early on we didn’t document it well. Would be great to address.

1 Like