Which delegate directly to Ecto's belongs_to and has_many associations. This isn't good because it doesn't allow proper scoping of the association, and we're kind of at a loss if we wanted to do something like:
has_many :deleted_posts, Post, &is_deleted/1 # can't do this
This just means we need another layer between the controller and the Ecto Models where we will declare scopes, probably something like:
defscope deleted_posts( thread) do
thread
|> build_assoc(:posts)
|> where([x], x.deleted_at is not null)
end
And have the autox toolchain be smart about looking for scopes.
right now, we do something like
Which delegate directly to Ecto's
belongs_to
andhas_many
associations. This isn't good because it doesn't allow proper scoping of the association, and we're kind of at a loss if we wanted to do something like:This just means we need another layer between the controller and the Ecto Models where we will declare scopes, probably something like:
And have the autox toolchain be smart about looking for scopes.