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

Share reverse chronological order scope #256

Open
potomak opened this issue Feb 5, 2017 · 0 comments
Open

Share reverse chronological order scope #256

potomak opened this issue Feb 5, 2017 · 0 comments
Labels

Comments

@potomak
Copy link
Member

potomak commented Feb 5, 2017

There's a common use case where we sort tomatoes by creation date.

@dalpo suggested to create something like this:

scope :sorted_desc, -> { order_by([[:created_at, :desc], [:_id, :desc]]) }

I wanted to create such a scope, but I didn't find a good name for it. sorted_desc is not descriptive enough.

reverse_chronological_order is too long.

latest_first or freshest_first (🍅), but they have first in them that seem like a selection of the first element.

created_at_desc, but it wouldn't include the second sorting condition on _id.

See #255 (review).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant