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

Fix cases when using where_object_changes_* with nil values #21

Merged
merged 6 commits into from
Feb 24, 2025

Conversation

andrepiske
Copy link
Collaborator

@andrepiske andrepiske commented Jan 30, 2025

Alright, so this PR initially began as a bug report, which is down below, and then turns out there was another more serious bug, which is that when using IronTrail::ChangeModelConcern#where_object_changes_(to|from) methods wiht a nil value, it'd break. This PR fixes that and also the bug described below.


Original bug report:

When ActiveRecord SQL Query Comments is enabled, AR will automatically disable prepared statements.

Without prepared statements, a test breaks like here: https://github.com/trusted/iron_trail/actions/runs/13052410073/job/36415455364

The fix is easy and just constitutes in converting the incoming value to a string, since the ->> JSON operator in PostgreSQL always returns a string, no matter the value type in the json object.


Asana link

@andrepiske andrepiske self-assigned this Jan 30, 2025
@andrepiske andrepiske changed the title [WIP] enable AR sql query comments [WIP] It breaks when prepared statements are disabled Jan 30, 2025
@andrepiske andrepiske changed the title [WIP] It breaks when prepared statements are disabled Fix cases when using where_object_changes_* with nil values Feb 21, 2025
@andrepiske andrepiske requested a review from a team February 21, 2025 19:00
@andrepiske andrepiske marked this pull request as ready for review February 21, 2025 19:00
@andrepiske andrepiske added the bug Something isn't working label Feb 21, 2025
@andrepiske andrepiske merged commit 67b0235 into main Feb 24, 2025
7 checks passed
@andrepiske andrepiske deleted the fix-no-prepared-statements branch February 24, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants