Fix boot crash on Redmine 7.0 / Rails 8: assign model_object instead of using removed DSL - #134
Merged
Conversation
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
approved these changes
Jul 1, 2026
Collaborator
|
Thank you very much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
OauthProvidersControlleris loaded, and it raises:Redmine 7.0 removed the class-level
model_objectDSL helper fromApplicationController(trunk r24017 / redmine.org #43205, #43230) and migrated its own controllers to assign theclass_attributedirectly (e.g.self.model_object = Document).model_objectis now only the 0-arg reader, somodel_object OauthProviderraises.Fix
class_attribute :model_objectgenerates themodel_object=writer in both Redmine 6.x and 7.x, so this keeps working under the currentrequires_redmine 6.0.0.Testing
Redmine 7.0.0 (Rails 8.1.3), Ruby 3.4.8:
ArgumentErrorabove and never becomes healthy (restart loop).OauthProvidersController, plus backup/restore, in-place update, and location change.