-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ApplicationRecord for Redmine 6 or later (#130)
Related: #126 ## Issue CI failed because of the following error. ```console 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. --------- Co-authored-by: Sutou Kouhei <[email protected]>
- Loading branch information
Showing
7 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# For backward compatibility with Redmine < 6. | ||
# ApplicationRecord is inherited from ActiveRecord Models instead of ActiveRecord::Base in Redmine >= 6. | ||
# ref: https://www.redmine.org/issues/38975 | ||
unless defined?(ApplicationRecord) | ||
ApplicationRecord = ActiveRecord::Base | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module FullTextSearch | ||
class IssueContent < ActiveRecord::Base | ||
class IssueContent < ApplicationRecord | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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