Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prototype] Sort by customer orders & lifetime value don't work #265

Closed
swrobel opened this issue Nov 22, 2015 · 3 comments
Closed

[Prototype] Sort by customer orders & lifetime value don't work #265

swrobel opened this issue Nov 22, 2015 · 3 comments

Comments

@c-lliope
Copy link
Contributor

c-lliope commented Dec 1, 2015

@swrobel Thanks for pointing this out!

lifetime_value doesn't work because it's a computed value. I think we'd be able to support this without much difficulty.

orders is a has_many relationship, which is a bit trickier. Perhaps the behavior that makes the most sense would be to sort by the number of associated records?

@getaaron
Copy link

getaaron commented Jul 12, 2016

@Graysonwright For has_many relationships, sorting by the number of associated records would be a pretty good default — better than what's there now.

Might be nice to offer the option to pass in a block to handle custom sorting logic like Enumerable's sort or the option to pass in a hash with options like in ActiveRecord's order. But I don't think either of these are as important as getting some sane default sorting behavior.

@pablobm
Copy link
Collaborator

pablobm commented Nov 11, 2019

With #999, the default sorting became:

  • has_many: by number of records.
  • belongs_to: by record id.

I'm having a think around how we could provide custom, per-attribute sortings, but I think that falls outside the scope of this issue, so I'm closing.

@pablobm pablobm closed this as completed Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants