diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-01-23 11:52:38 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-01-23 11:52:38 +0000 |
commit | 13aeb797cfaa5a70bd8903d8350ea8ce3e0bb151 (patch) | |
tree | 51ae69c0c3837e531b8cef6fac455e06eea04d88 /lib | |
parent | 28061fbcdb2cabbef698db2ca3a80cc428388456 (diff) | |
download | redmine-13aeb797cfaa5a70bd8903d8350ea8ce3e0bb151.tar.gz redmine-13aeb797cfaa5a70bd8903d8350ea8ce3e0bb151.zip |
Use ApplicationRecord instead of ActiveRecord::Base (#38975).
Patch by Minoru Maeda (@maeda-m).
git-svn-id: https://svn.redmine.org/redmine/trunk@22619 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb | 2 | ||||
-rw-r--r-- | lib/plugins/acts_as_activity_provider/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_attachable/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_customizable/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_event/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_searchable/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_tree/README | 2 | ||||
-rw-r--r-- | lib/plugins/acts_as_tree/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb | 2 | ||||
-rw-r--r-- | lib/plugins/acts_as_tree/test/acts_as_tree_test.rb | 2 | ||||
-rw-r--r-- | lib/plugins/acts_as_watchable/init.rb | 4 | ||||
-rw-r--r-- | lib/plugins/gravatar/init.rb | 4 | ||||
-rw-r--r-- | lib/redmine/preparation.rb | 6 |
13 files changed, 31 insertions, 15 deletions
diff --git a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb index 2715a7bbe..9fafbec77 100644 --- a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb +++ b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb @@ -63,6 +63,6 @@ class RedminePluginModelGenerator < Rails::Generators::NamedBase end def parent_class_name - options[:parent] || "ActiveRecord::Base" + options[:parent] || "ApplicationRecord" end end diff --git a/lib/plugins/acts_as_activity_provider/init.rb b/lib/plugins/acts_as_activity_provider/init.rb index eaf15886d..47f23c5f1 100644 --- a/lib/plugins/acts_as_activity_provider/init.rb +++ b/lib/plugins/acts_as_activity_provider/init.rb @@ -18,4 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_relative 'lib/acts_as_activity_provider' -ActiveRecord::Base.send(:include, Redmine::Acts::ActivityProvider) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::ActivityProvider) +end diff --git a/lib/plugins/acts_as_attachable/init.rb b/lib/plugins/acts_as_attachable/init.rb index e621b10ab..a19ae0595 100644 --- a/lib/plugins/acts_as_attachable/init.rb +++ b/lib/plugins/acts_as_attachable/init.rb @@ -18,4 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_relative 'lib/acts_as_attachable' -ActiveRecord::Base.send(:include, Redmine::Acts::Attachable) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::Attachable) +end diff --git a/lib/plugins/acts_as_customizable/init.rb b/lib/plugins/acts_as_customizable/init.rb index 7a85ef160..27bdb2f84 100644 --- a/lib/plugins/acts_as_customizable/init.rb +++ b/lib/plugins/acts_as_customizable/init.rb @@ -18,4 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_relative 'lib/acts_as_customizable' -ActiveRecord::Base.send(:include, Redmine::Acts::Customizable) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::Customizable) +end
\ No newline at end of file diff --git a/lib/plugins/acts_as_event/init.rb b/lib/plugins/acts_as_event/init.rb index 2669f1cf1..2b4feb607 100644 --- a/lib/plugins/acts_as_event/init.rb +++ b/lib/plugins/acts_as_event/init.rb @@ -18,4 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_relative 'lib/acts_as_event' -ActiveRecord::Base.send(:include, Redmine::Acts::Event) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::Event) +end
\ No newline at end of file diff --git a/lib/plugins/acts_as_searchable/init.rb b/lib/plugins/acts_as_searchable/init.rb index a268122d8..18598688b 100644 --- a/lib/plugins/acts_as_searchable/init.rb +++ b/lib/plugins/acts_as_searchable/init.rb @@ -18,4 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require_relative 'lib/acts_as_searchable' -ActiveRecord::Base.send(:include, Redmine::Acts::Searchable) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::Searchable) +end diff --git a/lib/plugins/acts_as_tree/README b/lib/plugins/acts_as_tree/README index a6cc6a904..a10826ff5 100644 --- a/lib/plugins/acts_as_tree/README +++ b/lib/plugins/acts_as_tree/README @@ -4,7 +4,7 @@ acts_as_tree Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children association. This requires that you have a foreign key column, which by default is called +parent_id+. - class Category < ActiveRecord::Base + class Category < ApplicationRecord acts_as_tree :order => "name" end diff --git a/lib/plugins/acts_as_tree/init.rb b/lib/plugins/acts_as_tree/init.rb index 36d1193d0..e7f63c70a 100644 --- a/lib/plugins/acts_as_tree/init.rb +++ b/lib/plugins/acts_as_tree/init.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true require_relative 'lib/active_record/acts/tree' -ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree +Rails.application.reloader.to_prepare do + ApplicationRecord.send :include, ActiveRecord::Acts::Tree +end diff --git a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb index 14dce355a..831056d59 100644 --- a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb +++ b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb @@ -10,7 +10,7 @@ module ActiveRecord # Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children # association. This requires that you have a foreign key column, which by default is called +parent_id+. # - # class Category < ActiveRecord::Base + # class Category < ApplicationRecord # acts_as_tree :order => "name" # end # diff --git a/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb b/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb index 94899f940..337411151 100644 --- a/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb +++ b/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb @@ -42,7 +42,7 @@ def teardown_db end end -class Mixin < ActiveRecord::Base +class Mixin < ApplicationRecord end class TreeMixin < Mixin diff --git a/lib/plugins/acts_as_watchable/init.rb b/lib/plugins/acts_as_watchable/init.rb index 6056987c7..565e27e1d 100644 --- a/lib/plugins/acts_as_watchable/init.rb +++ b/lib/plugins/acts_as_watchable/init.rb @@ -19,4 +19,6 @@ # Include hook code here require_relative 'lib/acts_as_watchable' -ActiveRecord::Base.send(:include, Redmine::Acts::Watchable) +Rails.application.reloader.to_prepare do + ApplicationRecord.send(:include, Redmine::Acts::Watchable) +end diff --git a/lib/plugins/gravatar/init.rb b/lib/plugins/gravatar/init.rb index a312000f5..648eeb282 100644 --- a/lib/plugins/gravatar/init.rb +++ b/lib/plugins/gravatar/init.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true require_relative 'lib/gravatar' -ActionView::Base.send :include, GravatarHelper::PublicMethods +Rails.application.reloader.to_prepare do + ApplicationRecord.send :include, GravatarHelper::PublicMethods +end diff --git a/lib/redmine/preparation.rb b/lib/redmine/preparation.rb index 64333672a..3042eaa94 100644 --- a/lib/redmine/preparation.rb +++ b/lib/redmine/preparation.rb @@ -20,9 +20,9 @@ module Redmine module Preparation def self.prepare - ActiveRecord::Base.include Redmine::Acts::Positioned - ActiveRecord::Base.include Redmine::Acts::Mentionable - ActiveRecord::Base.include Redmine::I18n + ApplicationRecord.include Redmine::Acts::Positioned + ApplicationRecord.include Redmine::Acts::Mentionable + ApplicationRecord.include Redmine::I18n Scm::Base.add "Subversion" Scm::Base.add "Mercurial" |