From b6c06b4900ae8602df43b5d363486894d7d2e924 Mon Sep 17 00:00:00 2001 From: alpaca-tc Date: Wed, 8 Nov 2023 14:39:47 +0900 Subject: [PATCH] Don't convert string to binary in Rails 7.0 --- lib/active_record_encryption/type/binary.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_record_encryption/type/binary.rb b/lib/active_record_encryption/type/binary.rb index d1cdbd9..ac6ff5c 100644 --- a/lib/active_record_encryption/type/binary.rb +++ b/lib/active_record_encryption/type/binary.rb @@ -2,7 +2,7 @@ module ActiveRecordEncryption class Type class Binary < ActiveModel::Type::Binary def cast(value) - return super if ActiveRecord::VERSION::STRING <= '7.1.0' + return super if ActiveRecord::VERSION::STRING < '7.0.0' if value.is_a?(Data) value.to_s