Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Note that this is a breaking change! Since this removes the newlines before the erb binding, it removes the newlines from the erb snippets, which can break erb code like this for example:
It will fail with something like:
To fix it we only have to add a semicolon, but still it's unexpected that a bugfix version breaks stuff.
The new code could also read the file twice (and execute erb bindings twice which may cause side effects!), while the old code only did it once.
Imo the only problem was that the
executemethod callsprepared_for_logsto generate the sql command (though you can disable it by callingquery.execute(false)).The name
prepared_for_logsimplies that it's meant to be used for logging the query, so i'm not sure why is that used to generate the executed sql command.Imo the default should be to execute the raw query. I'm not even sure why there is an option to execute an altered query with removed new lines? What's the use case for that?
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.
@sullerandras I've described the problem into issue #15 where a embedded variable that contains a string with multiple consecutive whitespaces was wrongly changed.
I've suggest a fix with this PR to avoid the buggy behaviour.
I've checked your use case and I agree with you this is a breaking change that should be reported into changelog.