Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove serializer deprecation warning.

Dombi Attila739223b7e278
diff --git a/app/models/custom_action.rb b/app/models/custom_action.rb
index 185e608ef45..5911c20f8ad 100644
--- a/app/models/custom_action.rb
+++ b/app/models/custom_action.rb
@@ -28,7 +28,7 @@
class CustomAction < ApplicationRecord
validates :name, length: { maximum: 255, minimum: 1 }
- serialize :actions, CustomActions::Actions::Serializer
+ serialize :actions, coder: CustomActions::Actions::Serializer
has_and_belongs_to_many :status_conditions, class_name: 'Status'
has_and_belongs_to_many :role_conditions, class_name: 'Role'
has_and_belongs_to_many :type_conditions, class_name: 'Type'
diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb
index d4b65398971..89b6e38922f 100644
--- a/app/models/menu_item.rb
+++ b/app/models/menu_item.rb
@@ -32,7 +32,7 @@ class MenuItem < ApplicationRecord
order('id ASC')
}, class_name: 'MenuItem', dependent: :destroy, foreign_key: :parent_id
- serialize :options, Hash
+ serialize :options, type: Hash
validates :title,
presence: true,
diff --git a/app/models/query.rb b/app/models/query.rb
index 708d00ac90f..a029ae9dbcf 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -45,9 +45,9 @@ class Query < ApplicationRecord
# dependent: :destroy is not possible as this would only delete the ical_token_query_assignments
before_destroy :destroy_ical_tokens
- serialize :filters, Queries::WorkPackages::FilterSerializer
- serialize :column_names, Array
- serialize :sort_criteria, Array
+ serialize :filters, coder: Queries::WorkPackages::FilterSerializer
+ serialize :column_names, type: Array
+ serialize :sort_criteria, type: Array
validates :include_subprojects,
inclusion: [true, false]
diff --git a/app/models/query/highlighting.rb b/app/models/query/highlighting.rb
index 5dfd54258fa..be260dd9a4a 100644
--- a/app/models/query/highlighting.rb
+++ b/app/models/query/highlighting.rb
@@ -41,7 +41,7 @@ module Query::Highlighting
QUERY_HIGHLIGHTING_MODES = %i[inline none status type priority].freeze
- serialize :highlighted_attributes, Array
+ serialize :highlighted_attributes, type: Array
validates :highlighting_mode,
inclusion: { in: QUERY_HIGHLIGHTING_MODES,
diff --git a/app/models/query/timelines.rb b/app/models/query/timelines.rb
index cf5012d2cb1..997a522c420 100644
--- a/app/models/query/timelines.rb
+++ b/app/models/query/timelines.rb
@@ -33,7 +33,7 @@ module Query::Timelines
enum timeline_zoom_level: { days: 0, weeks: 1, months: 2, quarters: 3, years: 4, auto: 5 }
validates :timeline_zoom_level, inclusion: { in: timeline_zoom_levels.keys }
- serialize :timeline_labels, Hash
+ serialize :timeline_labels, type: Hash
validate :valid_timeline_labels
def valid_timeline_labels
diff --git a/app/models/query/timestamps.rb b/app/models/query/timestamps.rb
index e23a810368e..d881d9b2352 100644
--- a/app/models/query/timestamps.rb
+++ b/app/models/query/timestamps.rb
@@ -30,7 +30,7 @@ module Query::Timestamps
extend ActiveSupport::Concern
included do
- serialize :timestamps, Array
+ serialize :timestamps, type: Array
# Returns the timestamps the query should be evaluated at.
#
diff --git a/app/models/token/base.rb b/app/models/token/base.rb
index 43347a466d7..e69b0c4a6c2 100644
--- a/app/models/token/base.rb
+++ b/app/models/token/base.rb
@@ -19,7 +19,7 @@
module Token
class Base < ApplicationRecord
self.table_name = 'tokens'
- serialize :data, ::Serializers::IndifferentHashSerializer
+ serialize :data, coder: ::Serializers::IndifferentHashSerializer
# Hashed tokens belong to a user and are unique per type
belongs_to :user
diff --git a/app/models/type/attribute_groups.rb b/app/models/type/attribute_groups.rb
index 739924546b9..d3c924693e0 100644
--- a/app/models/type/attribute_groups.rb
+++ b/app/models/type/attribute_groups.rb
@@ -34,7 +34,7 @@ module Type::AttributeGroups
after_save :unset_attribute_groups_objects
after_destroy :remove_attribute_groups_queries
- serialize :attribute_groups, Array
+ serialize :attribute_groups, type: Array
attr_accessor :attribute_groups_objects
# Mapping from AR attribute name to a default group
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 6811c2229d3..4094618a33a 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -29,7 +29,7 @@
class UserPreference < ApplicationRecord
belongs_to :user
delegate :notification_settings, to: :user
- serialize :settings, ::Serializers::IndifferentHashSerializer
+ serialize :settings, coder: ::Serializers::IndifferentHashSerializer
validates :user,
presence: true
diff --git a/db/migrate/20210825183540_make_user_preferences_json.rb b/db/migrate/20210825183540_make_user_preferences_json.rb
index 6f30a3b51d5..b03141633ed 100644
--- a/db/migrate/20210825183540_make_user_preferences_json.rb
+++ b/db/migrate/20210825183540_make_user_preferences_json.rb
@@ -33,8 +33,8 @@ class MakeUserPreferencesJson < ActiveRecord::Migration[6.1]
class UserPreferenceWithOthers < ::UserPreference
self.table_name = 'user_preferences'
- serialize :others, Hash
- serialize :settings, ::Serializers::IndifferentHashSerializer
+ serialize :others, type: Hash
+ serialize :settings, coder: ::Serializers::IndifferentHashSerializer
end
def up
diff --git a/modules/grids/app/models/grids/grid.rb b/modules/grids/app/models/grids/grid.rb
index 3821c662b10..7e395db5fee 100644
--- a/modules/grids/app/models/grids/grid.rb
+++ b/modules/grids/app/models/grids/grid.rb
@@ -30,7 +30,7 @@ module Grids
class Grid < ApplicationRecord
self.table_name = :grids
- serialize :options, Hash
+ serialize :options, type: Hash
has_many :widgets,
class_name: 'Widget',
diff --git a/modules/grids/app/models/grids/widget.rb b/modules/grids/app/models/grids/widget.rb
index d1c833fd1c5..a4970a67328 100644
--- a/modules/grids/app/models/grids/widget.rb
+++ b/modules/grids/app/models/grids/widget.rb
@@ -31,7 +31,7 @@ module Grids
self.table_name = :grid_widgets
belongs_to :grid
- serialize :options, Hash
+ serialize :options, type: Hash
after_destroy :execute_after_destroy_strategy
diff --git a/modules/reporting/app/models/cost_query.rb b/modules/reporting/app/models/cost_query.rb
index 795b1798cfa..726fb0a9569 100644
--- a/modules/reporting/app/models/cost_query.rb
+++ b/modules/reporting/app/models/cost_query.rb
@@ -35,7 +35,7 @@ class CostQuery < ApplicationRecord
belongs_to :project
before_save :serialize
- serialize :serialized, Hash
+ serialize :serialized, type: Hash
def_delegators :result, :real_costs
diff --git a/modules/webhooks/app/models/webhooks/log.rb b/modules/webhooks/app/models/webhooks/log.rb
index d1cb62ab34a..f09b689f2b3 100644
--- a/modules/webhooks/app/models/webhooks/log.rb
+++ b/modules/webhooks/app/models/webhooks/log.rb
@@ -6,8 +6,8 @@ module Webhooks
validates :event_name, presence: true
validates :response_code, presence: true
- serialize :response_headers, Hash
- serialize :request_headers, Hash
+ serialize :response_headers, type: Hash
+ serialize :request_headers, type: Hash
validates :request_headers, presence: true
validates :request_body, presence: true