Skip to content

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