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

It is impossible to sort by association's fields #21

Closed
kirushik opened this issue Mar 25, 2015 · 3 comments
Closed

It is impossible to sort by association's fields #21

kirushik opened this issue Mar 25, 2015 · 3 comments

Comments

@kirushik
Copy link

Let's say we have User class, which belongs to an Organization class.

In the sorted 1.0 it was possible to pass 'organizations.name' to sorted method on User.references(:organization).includes(:organization), and have our users list sorted by an association name (quite handy in admin views, for example).

With sorted 2.0 that seems no longer the case — it tries to sort by "users"."organizations.name", and that of course fails.

I think this is either an unintended regression in sorted 2.0, or plainly a missing feature.

@mynameisrufus
Copy link
Owner

Thanks @kirushik, I will have a look at this tomorrow, thanks for the detail.

@mynameisrufus
Copy link
Owner

@kirushik are you using sorted-activerecord or sorted? Could you please close this ticket and open it on https://github.com/mynameisrufus/sorted-activerecord with the code you trying to run, even better if you could provide me with a failing test, that would be very helpful 😃

@kirushik
Copy link
Author

kirushik commented Apr 8, 2015

@mynameisrufus OK, will do that today.

@kirushik kirushik closed this as completed Apr 8, 2015
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

2 participants