-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable ordering the BelongsTo fields by using order option. #2208
Enable ordering the BelongsTo fields by using order option. #2208
Conversation
8aa9b1a
to
dedec29
Compare
The change let the gem users to be able to order the fields by the column they'll specify, instead of ordering by `id`. I've also updated the query to solve the possible issues with `PG::AmbiguousColumn` errors - for now it's not handled in any way, so if the user is using the tables that use the same columns names, then the error will apear and the only way to fix that is to monkey patch the gem. To solve that, I've added the column name as the prefix for both possible forms of the query.
dedec29
to
dd86160
Compare
0dbd2fa
to
9a808a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I have left comments on minor points. Let me know what you think.
03c5b62
to
d38cd56
Compare
d38cd56
to
7265439
Compare
Hi @pablobm, AFAIU the failing CI tests are not related to my changes. I think I've done everything that you asked me to update/change/fix. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 🙂 Just one more thing and I think we can merge this.
7265439
to
1491ba3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Enable ordering the BelongsTo fields by using order option. The change let the gem users to be able to order the fields by the column they'll specify, instead of ordering by
id
.I've also updated the query to solve the possible issues with
PG::AmbiguousColumn
errors - for now it's not handled in any way, so if the user is using the tables that use the same columns names, then the error will apear and the only way to fix that is to monkey patch the gem. To solve that, I've added the column name as the prefix for both possible forms of the query.Based on #1215
And kinda related to #1805 the result is exactly as presented on videos attached to this task's description.