You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I was hoping to create a relationship that would grab the second newest record in a list without needing to create a Manual Relationship. My attempts thus far have failed because the has_one relationship DSL lacks an offset function.
Describe the solution you'd like
I'd like it if offset was included in the has_many and has_one relationships, and if limit was included in the has_many relationship.
Describe alternatives you've considered
I tried using read_action, pointed at a read action that used a query preparation to add sort, limit, and offset. Alas it seems to have gotten stripped out because it's just not intended to work that way. In this case, since it was a has_one relationship and the final query didn't include the limit clause, Ash returned an error saying it received multiple results when it expected only one.
My next approach will be to use a Manual Relationship, as suggested by Zach! But I'd love to have it in the DSL because as I understand it that means I can compose it more easily with other data layer operations, plus it just looks nice and is easier to do.
Express the feature either with a change to resource syntax, or with a change to the resource interface
Is your feature request related to a problem? Please describe.
I was hoping to create a relationship that would grab the second newest record in a list without needing to create a Manual Relationship. My attempts thus far have failed because the
has_one
relationship DSL lacks anoffset
function.Describe the solution you'd like
I'd like it if
offset
was included in thehas_many
andhas_one
relationships, and iflimit
was included in thehas_many
relationship.Describe alternatives you've considered
I tried using
read_action
, pointed at a read action that used a query preparation to add sort, limit, and offset. Alas it seems to have gotten stripped out because it's just not intended to work that way. In this case, since it was ahas_one
relationship and the final query didn't include thelimit
clause, Ash returned an error saying it received multiple results when it expected only one.My next approach will be to use a Manual Relationship, as suggested by Zach! But I'd love to have it in the DSL because as I understand it that means I can compose it more easily with other data layer operations, plus it just looks nice and is easier to do.
Express the feature either with a change to resource syntax, or with a change to the resource interface
The text was updated successfully, but these errors were encountered: