Where to define create action for many-many relationships?
The decision making isn't super clear to me.
In the Ash book, we have many-to-many between Artists and Users via ArtistFollowers. The create action is defined on the ArtistFollower resource.
Here, https://elixirforum.com/t/how-to-validate-ownership-in-an-action/64642 we have another many:many relationship between Users and Rooms, but instead the join room action is defined on the Room, not UserRooms
Any recommendations on things to think about?
For defining on the join resource, that feels more like RESTful design, but I guess that only matters if we have a JSON API?
While for defining on the "parent" resource, that feels a bit more natural to me, and makes authorization easier. If they were to create a RoomUser, I believe they'd want to create a check module to actually load the
In the Ash book, we have many-to-many between Artists and Users via ArtistFollowers. The create action is defined on the ArtistFollower resource.
Here, https://elixirforum.com/t/how-to-validate-ownership-in-an-action/64642 we have another many:many relationship between Users and Rooms, but instead the join room action is defined on the Room, not UserRooms
Any recommendations on things to think about?
For defining on the join resource, that feels more like RESTful design, but I guess that only matters if we have a JSON API?
While for defining on the "parent" resource, that feels a bit more natural to me, and makes authorization easier. If they were to create a RoomUser, I believe they'd want to create a check module to actually load the
room.owner, since all they'd have there is the room_id?Elixir Programming Language Forum
Hi, I’m currently building a toy chat app to learn Ash (a blog post is on the way) and I’m trying to understand where to put validations/authorizations for an action. This is what I’m trying to do: A User can join a Room if it is not private OR if the User is the Room’s owner. What is the Ash way to check ownership? Do I compare the :...

Ash