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

Ensure relation.order method receives Arel to silence deprecation warning #1196

Conversation

Polidoro
Copy link

@Polidoro Polidoro commented Jan 6, 2021

Ransack v2.4.1 introduced the postgres_fields_sort_option configuration option (an awesome feature by the way!)

That change has the side effect of converting scope_or_sort from an Arel to a string. This triggers certain versions of Rails to fire a warning every time an order is applied if postgres_fields_sort_option is set.

This fix ensures that if the ordering is converted to a string when the NULLS FIRST/NULLS LAST is appended it is then converted back into an Arel before being passed to relation.order. This silences the warnings because the sql is no longer a string when it is run.

More info on the warning can be found here: rails/rails#32995

@Polidoro Polidoro closed this Jan 6, 2021
@Polidoro
Copy link
Author

Polidoro commented Jan 6, 2021

I need to double check that this is reproducible, so closing this until I do.

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

Successfully merging this pull request may close these issues.

1 participant