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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove to_s from Arel.sql statements #12650
Conversation
It seems like you did not give us much information about what you are trying to do here. We would appreciate it if you could provide us with more info about this issue/PR! |
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.
This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']
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.
This pull request contains invalid labels. Please remove all of the following labels: ['type: bug']
@microstudi, thanks for the PR. I was looking at |
You're right @alecslupu, this is just a quick fix as it affects the valuator's part in external extensions we have. Maybe a maintenance task should look for subotimal sql queries and do this kind of refactoring. |
@microstudi , let me know if you want to continue fixing this PR, or you can work with the fix i have opened in #12669 |
@microstudi have you seen the last comment from Alex? You'd need to fix the git conflicts too, and fix the specs that are failing. |
@andreslucena is #12669 going to be backported? |
@microstudi, yes. #12669 is labeled as fix, so it will be backported. |
Let's discard this, we should probably in the future asses those complicate sql statements but my case should be solve with #12669. Thanks Alex! |
馃帺 What? Why?
As far as I know, the
Arel.sql
method is use to inject safe SQL inside queries. by usingto_s
after it, it becomes unsafe SQL again. Until now it didn't seem to be a problem but we found that is affecting the Proposal's scopesort_by_valuation_assignments_count_asc/desc
.This PR, removes all
to_s
statements (note that the other might be irrelevant as Rails might not find it dangerous), but still I think we should not use it.Looks like this is from Decidim 0.28 onwards.
馃搶 Related Issues
Link your PR to an issue
Testing
bin/rails c
)Decidim::Proposals::Proposal.sort_by_valuation_assignments_count_asc
馃摲 Screenshots
Please add screenshots of the changes you are proposing