diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2021-11-17 20:47:53 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2021-11-17 20:47:53 +0000 |
commit | 0352ab71cf89950f81e29f034529ce16b5bd9105 (patch) | |
tree | da8872339cd94c21713c8978dbc3db201d8b3413 | |
parent | 87097f2204f7bef10146da87162e2c1551d124d8 (diff) | |
download | redmine-0352ab71cf89950f81e29f034529ce16b5bd9105.tar.gz redmine-0352ab71cf89950f81e29f034529ce16b5bd9105.zip |
Add core extensions in prepare method (#29914, #32938).
Patch by Takashi Kato.
git-svn-id: http://svn.redmine.org/redmine/trunk@21285 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | config/initializers/10-patches.rb | 4 | ||||
-rw-r--r-- | config/initializers/30-redmine.rb | 9 | ||||
-rw-r--r-- | lib/redmine/acts/positioned.rb | 2 | ||||
-rw-r--r-- | lib/redmine/preparation.rb | 3 |
4 files changed, 7 insertions, 11 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 850ab460a..28f4f3670 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -1,11 +1,7 @@ # frozen_string_literal: true -require 'active_record' -require 'redmine/i18n' - module ActiveRecord class Base - include Redmine::I18n # Translate attribute names for validation errors display def self.human_attribute_name(attr, options = {}) prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '') diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb index 568bcb741..380c783f4 100644 --- a/config/initializers/30-redmine.rb +++ b/config/initializers/30-redmine.rb @@ -1,14 +1,13 @@ # frozen_string_literal: true -require 'redmine/i18n' require 'redmine/configuration' require 'redmine/plugin_loader' -I18n.backend = Redmine::I18n::Backend.new -# Forces I18n to load available locales from the backend -I18n.config.available_locales = nil - Rails.application.config.to_prepare do + I18n.backend = Redmine::I18n::Backend.new + # Forces I18n to load available locales from the backend + I18n.config.available_locales = nil + Redmine::Preparation.prepare end diff --git a/lib/redmine/acts/positioned.rb b/lib/redmine/acts/positioned.rb index ef25e48c7..6ef1bb80c 100644 --- a/lib/redmine/acts/positioned.rb +++ b/lib/redmine/acts/positioned.rb @@ -121,5 +121,3 @@ module Redmine end end end - -ActiveRecord::Base.send :include, Redmine::Acts::Positioned diff --git a/lib/redmine/preparation.rb b/lib/redmine/preparation.rb index 233a83fee..7223f2797 100644 --- a/lib/redmine/preparation.rb +++ b/lib/redmine/preparation.rb @@ -20,6 +20,9 @@ module Redmine module Preparation def self.prepare + ActiveRecord::Base.include Redmine::Acts::Positioned + ActiveRecord::Base.include Redmine::I18n + Scm::Base.add "Subversion" Scm::Base.add "Mercurial" Scm::Base.add "Cvs" |