Skip to content

Fix boot crash on Redmine 7.0 / Rails 8: assign model_object instead of using removed DSL - #134

Merged
picman merged 1 commit into
kontron:develfrom
BrutalBirdie:fix/redmine7-model_object
Jul 1, 2026
Merged

Fix boot crash on Redmine 7.0 / Rails 8: assign model_object instead of using removed DSL#134
picman merged 1 commit into
kontron:develfrom
BrutalBirdie:fix/redmine7-model_object

Conversation

@BrutalBirdie

Copy link
Copy Markdown
Contributor

Fixes #133

Problem

With Redmine 7.0 (Rails 8.1) the app crashes on boot whenever this plugin is installed. In production Rails eager-loads all controllers, OauthProvidersController is loaded, and it raises:

application_controller.rb:39:in 'model_object': wrong number of arguments (given 1, expected 0) (ArgumentError)
	from app/controllers/oauth_providers_controller.rb:24:in '<class:OauthProvidersController>'

Redmine 7.0 removed the class-level model_object DSL helper from ApplicationController (trunk r24017 / redmine.org #43205, #43230) and migrated its own controllers to assign the class_attribute directly (e.g. self.model_object = Document). model_object is now only the 0-arg reader, so model_object OauthProvider raises.

Fix

- model_object OauthProvider
+ self.model_object = OauthProvider

class_attribute :model_object generates the model_object= writer in both Redmine 6.x and 7.x, so this keeps working under the current requires_redmine 6.0.0.

Testing

Redmine 7.0.0 (Rails 8.1.3), Ruby 3.4.8:

  • Before: the app exits on boot with the ArgumentError above and never becomes healthy (restart loop).
  • After: the app boots normally, and the full Cloudron app lifecycle test passes (51/51), including the OAuth/OIDC login flow that routes through OauthProvidersController, plus backup/restore, in-place update, and location change.

Redmine 7.0 (Rails 8.1) removed the class-level `model_object` DSL from
ApplicationController and migrated its own controllers to assign the
class_attribute directly. Using the removed DSL makes the plugin raise
ArgumentError on boot under eager_load. Assign the attribute directly,
which works on both Redmine 6.x and 7.x.

Fixes kontron#133
@picman
picman self-requested a review July 1, 2026 10:16
@picman picman added the enhancement New feature or request label Jul 1, 2026
@picman picman added this to the 4.1.1 milestone Jul 1, 2026
@picman
picman changed the base branch from main to devel July 1, 2026 10:17
@picman
picman merged commit 4970cd2 into kontron:devel Jul 1, 2026
1 check passed
@picman

picman commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OauthProvidersController crashes app on boot with Redmine 7.0 / Rails 8 (removed model_object DSL)

2 participants