I went through the documentation and started a test project with it as I love the idea. Something about it bothers me, and I can't put it into words. Maybe it's due to not understanding enough about what is happening behind the scenes, and that it was based on Ecto which gives me the same ick.
Like defining relationships between the models, on one side you define "representatives" - the other side then magically gets a "representative_id"? Why remove the s, why change abstraction between an object and its id?
Why does the framework manage to add a return reference there, but in other places like between domains and resources you need to add the back reference by hand?
But in general, love the concepts and clearly a lot of work went into it.
Glad to hear you got a new project started, but let's address the ick factor.
When you define a relationship like `has_many :representatives`, Ash does’t create `representative_id` on the destination resource, we only validate that it exists and meets some criteria.
No resource ever modifies another resource, so you have to define the id on the other side using `belongs_to` which modifies it's own resource only adding the `respresentative_id` attribute with this
`belongs_to :representative, Representative`
If you need custom field names, you can override them:
`has_many :representatives, MyApp.Representative, destination_attribute: :custom_reference_id`
The docs explain more:
https://hexdocs.pm/ash/relationships.html#belongs-to
https://hexdocs.pm/ash/relationships.html#has-many