diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f5ce0be7..09a2705c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `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 # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -545,7 +545,7 @@ Metrics/BlockNesting: # Offense count: 14 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 646 + Max: 655 # Offense count: 24 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -2074,7 +2074,7 @@ Style/WordArray: EnforcedStyle: percent MinSize: 6 -# Offense count: 431 +# Offense count: 430 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https diff --git a/app/models/conference.rb b/app/models/conference.rb index 46505572..d678d22c 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -4,7 +4,12 @@ class Conference < ApplicationRecord include RevisionCount 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 # Dependent destroy will fail as roles#destroy will be cancelled,hence delete_all resourcify :roles, dependent: :delete_all @@ -826,7 +831,12 @@ class Conference < ApplicationRecord unless result[state.to_s.capitalize] result[state.to_s.capitalize] = {} 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 diff --git a/config/application.rb b/config/application.rb index fc72c02c..3dee15b9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -36,6 +36,6 @@ module Osem # This is a nightmare with our current data model, no one ever thought about this. 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 - 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