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: Serialization Error when the value is an empty string #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbhawsingka
Copy link

When we have nil for a foreign key, Rails converts it to an empty string before assigning the attributes to the model and hence it sends an empty string for serialization.
This returns MySQLBinUUID::InvalidUUID, "#{value} is not a valid UUID", and this PR aims to fix that.

@markoudev
Copy link
Member

Hi @sbhawsingka 👋 Thank you for contributing!

Could you please add a test case that reproduces the issue you're experiencing? I was under the impression that if a column is NULL in the database, Rails will keep it nil. Having a test case may help understand.

String#blank? is part of ActiveSupport, but ActiveSupport is not a dependency of this gem, so it can't be used. Ruby's .empty? can.

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.

2 participants