Skip to content

Version 15

Most impactful changes


Redmine 6 Upgrade

This document outlines the most impactful changes and deprecations introduced in the Redmine 6 upgrade. It is intended for developers and maintainers who need to understand the implications of these changes on their existing codebases.

Major Framework Upgrades

  • ruby >= 3.3.1~> 3.4.0
  • Added upper bound to Ruby version
  • From version 15.6.0: Ruby ~> 4.0.1 is required
  • For current version check platform_version file
  • rails ~> 6.1.7.107.2.2.1
  • Major framework upgrade
  • rack ~> 2.2.3>= 3.1.3

Breaking Changes

1. Aliasing Changes

Before:

alias_attribute :host_name, :host

After:

alias_method :host_name, :host
  • alias_attribute is now reserved for actual attributes
  • Use alias_method for methods or non-attributes

2. Serialization Changes

Before:

serialize :settings, Hash
serialize :data, Array

After:

serialize :settings, type: Hash
serialize :data, coder: JSON
  • Use type: parameter instead of direct class
  • For complex objects, use coder: parameter with a serializer class

3. ActiveSupport Deprecation Warnings

Before:

ActiveSupport::Deprecation.warn("This method is deprecated")

After:

ActiveSupport.deprecator.warn("This method is deprecated")
  • Changed from class method to instance method via the global deprecator

4. Asset Management

Before:

stylesheet_link_tag 'alerts', plugin: 'easy_alerts'

After:

stylesheet_link_tag 'alerts'
  • Removed plugin specification from asset helpers
  • Asset paths must be properly registered in initializers:
Rails.application.configure do
  asset_paths = EasyAssets.plugin_asset_paths("plugins/path/to/plugin")
  config.assets.paths.concat asset_paths
  config.assets.precompile << "your_asset.css"
end

5. Default Timezone Access

Before:

ActiveRecord::Base.default_timezone == :utc

After:

ActiveRecord.default_timezone == :utc
  • Default timezone now accessed through ActiveRecord instead of the class

6. Date/Time Formatting Changes

Before:

date_value.to_s(:db) # "2023-01-01"
time_value.to_s(:db) # "2023-01-01 12:34:56"

After:

date_value.to_fs(:db) # "2023-01-01"
time_value.to_fs(:db) # "2023-01-01 12:34:56"
  • Changed from to_s(:db) to to_fs(:db) for date/time formatting
  • This affects all date/time serialization to database format
  • Check any code that formats dates for database queries or display

Warnings / Deprecations

Deprecated but not yet removed in Rails 7.2.

1. Enum Declaration Changes

Before:

enum state: %i[pending active], _prefix: true
enum status: { running: 0, archived: 1 }, _default: :running

After:

enum :state, %i[pending active], prefix: true
enum :status, { running: 0, archived: 1 }, default: :running

The enum syntax has changed significantly:

  • First parameter is now a method name (:status instead of status:)
  • Removed underscore from some enum options (prefix:, suffix:, default: instead of _prefix:, _suffix:, _default:)

Other important changes

1. Using Vite for JavaScript Asset Management

We are moving away from Sprockets and using Vite for JavaScript asset management. A new endpoint app/frontend/entrypoints/easy_legacy_js.js has been created for legacy JavaScripts.

Before:

plugins/easyproject/easy_plugins/easy_extensions/assets/javascripts/context_menu.js

After:

app/frontend/src/easy_legacy_js/context_menu.js

// app/frontend/src/easy_legacy_js/context_menu.js
import "../src/easy_legacy_js/context_menu";
  • Move legacy JavaScript files to app/frontend/src/easy_legacy_js/
  • Import them in app/frontend/entrypoints/easy_legacy_js.js

2. Inheriting ActiveRecord models from ApplicationRecord

All ActiveRecord models should now inherit from ApplicationRecord instead of ActiveRecord::Base.

Before:

class User < ActiveRecord::Base
  # ...
end

After:

class User < ApplicationRecord
  # ...
end

Recommendations for Upgrading

  1. Test thoroughly - The framework changes are substantial and require extensive testing
  2. Update dependencies - Update your gem dependencies to match the new requirements
  3. Refactor enums and serializers - These need immediate attention for compatibility
  4. Check asset loading - Ensure your assets are properly registered and loaded
  5. Update deprecation warnings - Replace deprecated calls with new methods
  6. Review database migrations - Ensure compatibility with the new database handling
  7. Consider Rails 7 compatibility - Review Rails 7 upgrade guide for additional changes not covered here