From d669ac5caeaeac5db62291d3cda94f345bd58bfd Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Wed, 26 Mar 2025 15:31:53 -0600 Subject: [PATCH 1/4] Add `coder :YAML` to `serialize` for Rails 7.1 - Added explicit `coder: YAML` to `serialize` calls to conform with Rails 7.1 changes - (Rather than explicitly adding this, `config.active_record.default_column_serializer = YAML` could've been added to `config/application.rb` to restore the pre-Rails 7.1 behaviour) - Retained `type:` where specified to enforce the expected type of deserialized objects. --- app/models/condition.rb | 4 ++-- app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/condition.rb b/app/models/condition.rb index fd13793009..ed01978f5e 100644 --- a/app/models/condition.rb +++ b/app/models/condition.rb @@ -28,8 +28,8 @@ class Condition < ApplicationRecord belongs_to :question enum action_type: %i[remove add_webhook] - serialize :option_list, type: Array - serialize :remove_data, type: Array + serialize :option_list, type: Array, coder: YAML + serialize :remove_data, type: Array, coder: YAML serialize :webhook_data, coder: JSON # Sort order: Number ASC diff --git a/app/models/user.rb b/app/models/user.rb index 4d93247c4a..968e150cc8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -70,7 +70,7 @@ class User < ApplicationRecord ## # User Notification Preferences - serialize :prefs, type: Hash + serialize :prefs, type: Hash, coder: YAML # default user language to the default language attribute :language_id, :integer, default: -> { Language.default&.id } From f26b54f052306f61ef63212ed137ce02bfe24f95 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Wed, 26 Mar 2025 15:55:42 -0600 Subject: [PATCH 2/4] Match `config.load_defaults` to Rails (v7.1) --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 00638820ea..882ebb0def 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ module DMPRoadmap # DMPRoadmap application class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 7.1 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers From 76cc7eb71fd998fcb7f5d2427e9c9a3a1e822f28 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Wed, 26 Mar 2025 16:23:05 -0600 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 961e2504fe..c9f4c8a362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -- Updated app to Rails 7 [#3426](https://github.com/DMPRoadmap/roadmap/pull/3426) +- Updated app to Rails 7 [#3426](https://github.com/DMPRoadmap/roadmap/pull/3426), [#3496](https://github.com/DMPRoadmap/roadmap/pull/3496) - Address Some Bullet Warnings / Optimise Mean Request Times [#3440](https://github.com/DMPRoadmap/roadmap/pull/3440) - Fix Flaky Tests / Optimize Checking of `plan.title` Within `spec/features/plans/exports_spec.rb` [#3451](https://github.com/DMPRoadmap/roadmap/pull/3451) - Refactor Plan.deep_copy(plan) [#3469](https://github.com/DMPRoadmap/roadmap/pull/3469) From 122680327bf53567944fcb94575ea36f8faa3bd7 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Thu, 3 Apr 2025 14:19:21 -0600 Subject: [PATCH 4/4] Remove unused `serialize :prefs` from User model The `serialize :prefs, type: Hash` line in the `User` model was redundant since the `prefs` column does not exist in the `users` table. User preferences are handled via the `Pref` model, which serializes its `settings` column as a JSON hash. This change aligns with the update to store preferences in a separate model, as introduced in the following commit: https://github.com/DMPRoadmap/roadmap/commit/0405973ece6f182dc7c855c26a71f48c5beebaf2 --- app/models/user.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 968e150cc8..e3ecccf039 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -68,10 +68,6 @@ class User < ApplicationRecord :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: %i[shibboleth orcid] - ## - # User Notification Preferences - serialize :prefs, type: Hash, coder: YAML - # default user language to the default language attribute :language_id, :integer, default: -> { Language.default&.id }