Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make ActiveRecord models inherit from ApplicationRecord

Christophe Bliardf87a7c4f5c70
diff --git a/app/models/projects/status.rb b/app/models/projects/status.rb
index 7ee66ca97be..d0af5fc25a3 100644
--- a/app/models/projects/status.rb
+++ b/app/models/projects/status.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Projects::Status < ActiveRecord::Base
+class Projects::Status < ApplicationRecord
belongs_to :project
self.table_name = 'project_statuses'
diff --git a/lib/open_project/text_formatting/formats/markdown/textile_converter.rb b/lib/open_project/text_formatting/formats/markdown/textile_converter.rb
index 11ac020eb64..ba9e6d959c6 100644
--- a/lib/open_project/text_formatting/formats/markdown/textile_converter.rb
+++ b/lib/open_project/text_formatting/formats/markdown/textile_converter.rb
@@ -510,7 +510,7 @@ module OpenProject::TextFormatting::Formats
end
end
- class OldForum < ::ActiveRecord::Base
+ class OldForum < ApplicationRecord
self.table_name = 'boards'
end
end
diff --git a/lib/tasks/attachment_migrations.rake b/lib/tasks/attachment_migrations.rake
index ecc4dce4168..519bccea6a7 100644
--- a/lib/tasks/attachment_migrations.rake
+++ b/lib/tasks/attachment_migrations.rake
@@ -36,6 +36,7 @@ module Migrations
# We create a separate classes as this is most likely to be used during
# the migration of an ChiliProject (2.x or 3.x) which lacks a couple
# of columns models have in OpenProject >6.
+ # rubocop:disable Rails/ApplicationRecord
module Attachments
class CurrentWikiPage < ::ActiveRecord::Base
self.table_name = "wiki_pages"
@@ -47,6 +48,7 @@ module Migrations
self.table_name = "wiki_contents"
end
end
+ # rubocop:enable Rails/ApplicationRecord
end
namespace :migrations do
diff --git a/lib/tasks/delete_documents.rake b/lib/tasks/delete_documents.rake
index 037eae1943f..a01fa6d80de 100644
--- a/lib/tasks/delete_documents.rake
+++ b/lib/tasks/delete_documents.rake
@@ -32,10 +32,12 @@ namespace :migrations do
namespace :documents do
include Tasks::Shared::UserFeedback
+ # rubocop:disable Rails/ApplicationRecord
class TemporaryDocument < ActiveRecord::Base
belongs_to :project
belongs_to :category, class_name: 'DocumentCategory'
end
+ # rubocop:enable Rails/ApplicationRecord
desc 'Removes all documents'
task delete: :environment do |_task|
diff --git a/modules/bim/app/models/bim/bcf/comment.rb b/modules/bim/app/models/bim/bcf/comment.rb
index 86b2ab25a7b..91efda10743 100644
--- a/modules/bim/app/models/bim/bcf/comment.rb
+++ b/modules/bim/app/models/bim/bcf/comment.rb
@@ -27,7 +27,7 @@
#++
module Bim::Bcf
- class Comment < ActiveRecord::Base
+ class Comment < ApplicationRecord
self.table_name = :bcf_comments
include InitializeWithUuid
diff --git a/modules/bim/app/models/bim/bcf/issue.rb b/modules/bim/app/models/bim/bcf/issue.rb
index 31c0f72d46f..7ff39b8889d 100644
--- a/modules/bim/app/models/bim/bcf/issue.rb
+++ b/modules/bim/app/models/bim/bcf/issue.rb
@@ -1,5 +1,5 @@
module Bim::Bcf
- class Issue < ActiveRecord::Base
+ class Issue < ApplicationRecord
self.table_name = :bcf_issues
include InitializeWithUuid
diff --git a/modules/bim/app/models/bim/bcf/viewpoint.rb b/modules/bim/app/models/bim/bcf/viewpoint.rb
index b652d5ebd02..90d854d045d 100644
--- a/modules/bim/app/models/bim/bcf/viewpoint.rb
+++ b/modules/bim/app/models/bim/bcf/viewpoint.rb
@@ -27,7 +27,7 @@
#++
module Bim::Bcf
- class Viewpoint < ActiveRecord::Base
+ class Viewpoint < ApplicationRecord
self.table_name = :bcf_viewpoints
include InitializeWithUuid
diff --git a/modules/bim/app/models/bim/ifc_models/ifc_model.rb b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
index 4352f7e6c52..c72073e8c27 100644
--- a/modules/bim/app/models/bim/ifc_models/ifc_model.rb
+++ b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
@@ -1,6 +1,6 @@
module Bim
module IfcModels
- class IfcModel < ActiveRecord::Base
+ class IfcModel < ApplicationRecord
enum conversion_status: {
pending: 0,
processing: 1,
diff --git a/modules/costs/app/models/time_entry_activities_project.rb b/modules/costs/app/models/time_entry_activities_project.rb
index 3e0ec141dcd..dda89744844 100644
--- a/modules/costs/app/models/time_entry_activities_project.rb
+++ b/modules/costs/app/models/time_entry_activities_project.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class TimeEntryActivitiesProject < ActiveRecord::Base
+class TimeEntryActivitiesProject < ApplicationRecord
belongs_to :project
belongs_to :activity, class_name: 'TimeEntryActivity'
end
diff --git a/modules/grids/app/models/grids/grid.rb b/modules/grids/app/models/grids/grid.rb
index d2c32083ad1..bb538f37d6b 100644
--- a/modules/grids/app/models/grids/grid.rb
+++ b/modules/grids/app/models/grids/grid.rb
@@ -27,7 +27,7 @@
#++
module Grids
- class Grid < ActiveRecord::Base
+ class Grid < ApplicationRecord
self.table_name = :grids
serialize :options, Hash
diff --git a/modules/grids/app/models/grids/widget.rb b/modules/grids/app/models/grids/widget.rb
index a51dbb4e5a3..c5cf6d50174 100644
--- a/modules/grids/app/models/grids/widget.rb
+++ b/modules/grids/app/models/grids/widget.rb
@@ -27,7 +27,7 @@
#++
module Grids
- class Widget < ActiveRecord::Base
+ class Widget < ApplicationRecord
self.table_name = :grid_widgets
belongs_to :grid
diff --git a/modules/overviews/db/migrate/20190826083604_my_project_page_to_grid.rb b/modules/overviews/db/migrate/20190826083604_my_project_page_to_grid.rb
index 35f068b936e..350da815b9f 100644
--- a/modules/overviews/db/migrate/20190826083604_my_project_page_to_grid.rb
+++ b/modules/overviews/db/migrate/20190826083604_my_project_page_to_grid.rb
@@ -1,4 +1,5 @@
class MyProjectPageToGrid < ActiveRecord::Migration[5.2]
+ # rubocop:disable Rails/ApplicationRecord
class MyPageEntry < ActiveRecord::Base
self.table_name = 'my_projects_overviews'
@@ -8,6 +9,7 @@ class MyProjectPageToGrid < ActiveRecord::Migration[5.2]
belongs_to :project
end
+ # rubocop:enable Rails/ApplicationRecord
def up
return unless applicable?