redmine_wiki_extensions
redmine_wiki_extensions copied to clipboard
Use ApplicationRecord for Redmine 6 or later
Please look at this PR first https://github.com/haru/redmine_wiki_extensions/pull/39. After https://github.com/haru/redmine_wiki_extensions/pull/39, CI will be failed and then this PR will resolve it.
Issue
CI failed because of the following error.
/usr/local/bundle/gems/activerecord-7.1.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `acts_as_event' for WikiExtensionsComment:Class (NoMethodError)
ref: https://github.com/otegami/redmine_wiki_extensions/actions/runs/8228360886/job/22497676680
Cause
Redmine::Acts::Event
isn't included in ActiveRecord::Base
anymore. That's the reason we cannot use Redmine::Acts::Event#acts_as_event
.
Before Redmine v5.1, ActiveRecord::Base
included Redmine::Acts::Event
. And ActiveRecord::Base
was a base class.
https://github.com/redmine/redmine/blob/ed7873a4c49d9209c597378dab9a982391093c32/lib/plugins/acts_as_event/init.rb#L4
After Redmine v6(master), ApplicationRecord
includes Redmine::Acts::Event
. And ApplicationRecord
is a base class.
https://github.com/redmine/redmine/blob/fb449c77bc76b3bae9b3f0bfe18560b11f00902c/lib/plugins/acts_as_event/init.rb#L22
Solution
Change the base class from ActiveRecord::Base to ApplicationRecord.
Code Climate has analyzed commit 2d3e5082 and detected 0 issues on this pull request.
View more on Code Climate.