clear-code / redmine_full_text_search

Full text search for Redmine
MIT License
61 stars 24 forks source link

Use ApplicationRecord for Redmine 6 or later #130

Closed otegami closed 5 months ago

otegami commented 5 months ago

Related: https://github.com/clear-code/redmine_full_text_search/issues/126

Issue

CI failed because of the following error.

Error:
FullTextSearch::SearchControllerTest::AttachmentTest#test_api:
NoMethodError: undefined method `acts_as_event' for FullTextSearch::Target:Class

ref: https://github.com/clear-code/redmine_full_text_search/actions/runs/8164642884/job/22320305058

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 master, ApplicationRecord included Redmine::Acts::Event. And ApplicationRecord was 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.