Feature #32938 » alt-0003-Add-core-extensions-in-prepare-method.patch
| config/initializers/10-patches.rb | ||
|---|---|---|
| 1 | 1 |
# frozen_string_literal: true |
| 2 | 2 | |
| 3 |
require 'active_record' |
|
| 4 |
require 'redmine/i18n' |
|
| 5 | ||
| 6 | 3 |
module ActiveRecord |
| 7 | 4 |
class Base |
| 8 |
include Redmine::I18n |
|
| 9 | 5 |
# Translate attribute names for validation errors display |
| 10 | 6 |
def self.human_attribute_name(attr, options = {})
|
| 11 | 7 |
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '') |
| config/initializers/30-redmine.rb | ||
|---|---|---|
| 1 | 1 |
# frozen_string_literal: true |
| 2 | 2 | |
| 3 |
require 'redmine/i18n' |
|
| 4 | 3 |
require 'redmine/configuration' |
| 5 | 4 |
require 'redmine/plugin_loader' |
| 6 | 5 | |
| 7 |
I18n.backend = Redmine::I18n::Backend.new |
|
| 8 |
# Forces I18n to load available locales from the backend |
|
| 9 |
I18n.config.available_locales = nil |
|
| 10 | ||
| 11 | 6 |
Rails.application.config.to_prepare do |
| 7 |
I18n.backend = Redmine::I18n::Backend.new |
|
| 8 |
# Forces I18n to load available locales from the backend |
|
| 9 |
I18n.config.available_locales = nil |
|
| 10 | ||
| 12 | 11 |
Redmine::Preparation.prepare |
| 13 | 12 |
end |
| 14 | 13 | |
| lib/redmine/acts/positioned.rb | ||
|---|---|---|
| 121 | 121 |
end |
| 122 | 122 |
end |
| 123 | 123 |
end |
| 124 | ||
| 125 |
ActiveRecord::Base.send :include, Redmine::Acts::Positioned |
|
| lib/redmine/preparation.rb | ||
|---|---|---|
| 20 | 20 |
module Redmine |
| 21 | 21 |
module Preparation |
| 22 | 22 |
def self.prepare |
| 23 |
ActiveRecord::Base.include Redmine::Acts::Positioned |
|
| 24 |
ActiveRecord::Base.include Redmine::I18n |
|
| 25 | ||
| 23 | 26 |
Scm::Base.add "Subversion" |
| 24 | 27 |
Scm::Base.add "Mercurial" |
| 25 | 28 |
Scm::Base.add "Cvs" |