Ash FrameworkAF
Ash Framework9mo ago
33 replies
pikdum

Is there a way to do a 'limit' on a relationship?

My use case is eventually an aggregate, like 'count of the last 10 posts that are unpublished'.
Was thinking I could get something working if I set up a relationship that was 'most recent 10 posts', and then an aggregate count on that relationship, but not seeing anything on how that'd work.
Any ideas?
Solution
Yeah, that would work. You could also see what happens if you do this:

has_many :last_ten... do
  read_action :an_action_with_a_limit
end
Was this page helpful?