Adapt to Rails 7.2 Serialization
This commit is contained in:
parent
3a2df26b91
commit
7948a5356e
3 changed files with 16 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2025-08-12 13:33:30 UTC using RuboCop version 1.79.2.
|
# on 2025-08-12 15:04:30 UTC using RuboCop version 1.79.2.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
|
|
@ -545,7 +545,7 @@ Metrics/BlockNesting:
|
||||||
# Offense count: 14
|
# Offense count: 14
|
||||||
# Configuration parameters: CountComments, CountAsOne.
|
# Configuration parameters: CountComments, CountAsOne.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Max: 646
|
Max: 655
|
||||||
|
|
||||||
# Offense count: 24
|
# Offense count: 24
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||||
|
|
@ -2074,7 +2074,7 @@ Style/WordArray:
|
||||||
EnforcedStyle: percent
|
EnforcedStyle: percent
|
||||||
MinSize: 6
|
MinSize: 6
|
||||||
|
|
||||||
# Offense count: 431
|
# Offense count: 430
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,12 @@ class Conference < ApplicationRecord
|
||||||
include RevisionCount
|
include RevisionCount
|
||||||
|
|
||||||
require 'uri'
|
require 'uri'
|
||||||
serialize :events_per_week, Hash
|
|
||||||
|
if RailsVersion.next?
|
||||||
|
serialize :events_per_week, type: Hash
|
||||||
|
else
|
||||||
|
serialize :events_per_week, Hash
|
||||||
|
end
|
||||||
# Needed to call 'Conference.with_role' in /models/ability.rb
|
# Needed to call 'Conference.with_role' in /models/ability.rb
|
||||||
# Dependent destroy will fail as roles#destroy will be cancelled,hence delete_all
|
# Dependent destroy will fail as roles#destroy will be cancelled,hence delete_all
|
||||||
resourcify :roles, dependent: :delete_all
|
resourcify :roles, dependent: :delete_all
|
||||||
|
|
@ -826,7 +831,12 @@ class Conference < ApplicationRecord
|
||||||
unless result[state.to_s.capitalize]
|
unless result[state.to_s.capitalize]
|
||||||
result[state.to_s.capitalize] = {}
|
result[state.to_s.capitalize] = {}
|
||||||
end
|
end
|
||||||
result[state.to_s.capitalize][week.strftime('%W').to_i] = value
|
week_date_time = if RailsVersion.next?
|
||||||
|
DateTime.parse(week)
|
||||||
|
else
|
||||||
|
week
|
||||||
|
end
|
||||||
|
result[state.to_s.capitalize][week_date_time.strftime('%W').to_i] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,6 @@ module Osem
|
||||||
# This is a nightmare with our current data model, no one ever thought about this.
|
# This is a nightmare with our current data model, no one ever thought about this.
|
||||||
config.active_record.belongs_to_required_by_default = false
|
config.active_record.belongs_to_required_by_default = false
|
||||||
# https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
|
# https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
|
||||||
config.active_record.yaml_column_permitted_classes = ['Date', 'DateTime', 'Symbol', 'Time', 'ActiveSupport::TimeWithZone', 'ActiveSupport::TimeZone']
|
config.active_record.yaml_column_permitted_classes = [Date, DateTime, Symbol, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue