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

Sorting #7

Open
nathansamson opened this issue Nov 23, 2016 · 9 comments
Open

Sorting #7

nathansamson opened this issue Nov 23, 2016 · 9 comments
Assignees

Comments

@nathansamson
Copy link

Does the system allow for easy ordering?

eg. order(name: :asc) where name is a translated field? How well does it combine with fallbacks?

I did not see anything in the documentation, nor did I see anything in the code that would support this on first sight

Would it be hard to implement?

@openscript
Copy link
Owner

openscript commented Nov 24, 2016

Thank you for creating the issue.

Sorting is not implemented, but it shouldn't be hard to do so. I'll have a look into it this weekend.

@openscript openscript self-assigned this Nov 24, 2016
@openscript
Copy link
Owner

I've implemented sorting. Please check it out.

@nathansamson
Copy link
Author

Hi,

Thanks for sorting this out (pun not intended).

Note that I have rolled out our own implementation based on JSON(B) which also implements fallbacks in sorting.

@daniel-rikowski
Copy link

The 0.3 release breaks order calls without a sorting direction. e.g. order(:position):

NoMethodError: private method `select' called for :position:Symbol

@openscript
Copy link
Owner

@daniel-rikowski I'll fix that in a second.

@openscript
Copy link
Owner

Sorry about that.

@openscript
Copy link
Owner

@daniel-rikowski I've pushed another version.

Probably I'll also switch over to a json solution, due it's more handy if you need to deliver json through a api anyway.

@daniel-rikowski
Copy link

daniel-rikowski commented Feb 3, 2017

Thank you!

Symbols do work now, but combinations still do not, e.g.

Model.order(:position, id: :desc)

This results in a call like order(position: :asc, { id: :desc } => :asc }

Strings work (order('position DESC')) but I'm not sure if that is by design or just coincidence, because there are no tests for that case.

@openscript
Copy link
Owner

@daniel-rikowski I'll look into it.

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

No branches or pull requests

3 participants