From c99c50c50e792ddb073a37d47c6ffae80bfcc642 Mon Sep 17 00:00:00 2001 From: sbhawsingka Date: Wed, 8 Feb 2023 16:47:08 +0530 Subject: [PATCH] FIX: Serialization Error when the value is an empty string --- lib/mysql-binuuid/type.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mysql-binuuid/type.rb b/lib/mysql-binuuid/type.rb index 8273fa6..6dac8f3 100644 --- a/lib/mysql-binuuid/type.rb +++ b/lib/mysql-binuuid/type.rb @@ -27,7 +27,8 @@ def cast(value) # Invoked when the provided value needs to be serialized before storing # it to the database. def serialize(value) - return if value.nil? + return if value.blank? + undashed_uuid = strip_dashes(value) # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord