From e93e8bf1f6b0df8551c767186c4101e5ed652f2f Mon Sep 17 00:00:00 2001 From: Mikkel Malmberg Date: Wed, 20 Sep 2023 20:38:39 +0200 Subject: [PATCH] Fix serialize type deprecation warning on Rails 7.1+ --- lib/rails-settings/setting_object.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rails-settings/setting_object.rb b/lib/rails-settings/setting_object.rb index 5f60f30..865a2ea 100644 --- a/lib/rails-settings/setting_object.rb +++ b/lib/rails-settings/setting_object.rb @@ -13,7 +13,11 @@ class SettingObject < ActiveRecord::Base end end - serialize :value, Hash + if Rails.version >= "7.1" + serialize :value, type: Hash + else + serialize :value, Hash + end if RailsSettings.can_protect_attributes? # attr_protected can not be used here because it touches the database which is not connected yet.