Patch #38975 » use_application_record_models.patch
| .rubocop.yml | ||
|---|---|---|
|
# TODO: Need to check the impact on plugins. Disable for now.
|
||
|
- 'lib/redmine/preparation.rb'
|
||
|
Rails/ApplicationRecord:
|
||
|
Exclude:
|
||
|
- 'db/migrate/0*.rb'
|
||
|
Rails/BulkChangeTable:
|
||
|
Exclude:
|
||
|
- 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
|
||
| .rubocop_todo.yml | ||
|---|---|---|
|
- 'app/models/mail_handler.rb'
|
||
|
- 'app/models/mailer.rb'
|
||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||
|
Rails/ApplicationRecord:
|
||
|
Enabled: false
|
||
|
# This cop supports safe autocorrection (--autocorrect).
|
||
|
# Configuration parameters: Include.
|
||
|
# Include: **/test/**/*
|
||
| app/controllers/watchers_controller.rb | ||
|---|---|---|
|
nil
|
||
|
end
|
||
|
return unless klass && Class === klass # rubocop:disable Style/CaseEquality
|
||
|
return unless klass < ActiveRecord::Base
|
||
|
return unless klass < ApplicationRecord
|
||
|
return unless klass < Redmine::Acts::Watchable::InstanceMethods
|
||
|
scope = klass.where(:id => Array.wrap(params[:object_id]))
|
||
| app/models/application_record.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
# Redmine - project management software
|
||
|
# Copyright (C) 2006-2023 Jean-Philippe Lang
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class ApplicationRecord < ActiveRecord::Base
|
||
|
self.abstract_class = true
|
||
|
# Translate attribute names for validation errors display
|
||
|
def self.human_attribute_name(attr, options = {})
|
||
|
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
|
||
|
class_prefix = name.underscore.tr('/', '_')
|
||
|
redmine_default = [
|
||
|
:"field_#{class_prefix}_#{prepared_attr}",
|
||
|
:"field_#{prepared_attr}"
|
||
|
]
|
||
|
options[:default] = redmine_default + Array(options[:default])
|
||
|
super
|
||
|
end
|
||
|
end
|
||
| app/models/attachment.rb | ||
|---|---|---|
|
require "fileutils"
|
||
|
require "zip"
|
||
|
class Attachment < ActiveRecord::Base
|
||
|
class Attachment < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :container, :polymorphic => true
|
||
|
belongs_to :author, :class_name => "User"
|
||
| app/models/auth_source.rb | ||
|---|---|---|
|
class AuthSourceException < StandardError; end
|
||
|
class AuthSourceTimeoutException < AuthSourceException; end
|
||
|
class AuthSource < ActiveRecord::Base
|
||
|
class AuthSource < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
include Redmine::SubclassFactory
|
||
|
include Redmine::Ciphering
|
||
| app/models/board.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Board < ActiveRecord::Base
|
||
|
class Board < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :project
|
||
|
has_many :messages, lambda {order("#{Message.table_name}.created_on DESC")}, :dependent => :destroy
|
||
| app/models/change.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Change < ActiveRecord::Base
|
||
|
class Change < ApplicationRecord
|
||
|
belongs_to :changeset
|
||
|
validates_presence_of :changeset_id, :action, :path
|
||
| app/models/changeset.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Changeset < ActiveRecord::Base
|
||
|
class Changeset < ApplicationRecord
|
||
|
belongs_to :repository
|
||
|
belongs_to :user
|
||
|
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
|
||
| app/models/comment.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Comment < ActiveRecord::Base
|
||
|
class Comment < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :commented, :polymorphic => true, :counter_cache => true
|
||
|
belongs_to :author, :class_name => 'User'
|
||
| app/models/custom_field.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class CustomField < ActiveRecord::Base
|
||
|
class CustomField < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
include Redmine::SubclassFactory
|
||
| app/models/custom_field_enumeration.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class CustomFieldEnumeration < ActiveRecord::Base
|
||
|
class CustomFieldEnumeration < ApplicationRecord
|
||
|
belongs_to :custom_field
|
||
|
validates_presence_of :name, :position, :custom_field_id
|
||
| app/models/custom_value.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class CustomValue < ActiveRecord::Base
|
||
|
class CustomValue < ApplicationRecord
|
||
|
belongs_to :custom_field
|
||
|
belongs_to :customized, :polymorphic => true
|
||
| app/models/document.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Document < ActiveRecord::Base
|
||
|
class Document < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :project
|
||
|
belongs_to :category, :class_name => "DocumentCategory"
|
||
| app/models/email_address.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class EmailAddress < ActiveRecord::Base
|
||
|
class EmailAddress < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
EMAIL_REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i
|
||
| app/models/enabled_module.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class EnabledModule < ActiveRecord::Base
|
||
|
class EnabledModule < ApplicationRecord
|
||
|
belongs_to :project
|
||
|
acts_as_watchable
|
||
| app/models/enumeration.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Enumeration < ActiveRecord::Base
|
||
|
class Enumeration < ApplicationRecord
|
||
|
include Redmine::SubclassFactory
|
||
|
default_scope lambda {order(:position)}
|
||
| app/models/import.rb | ||
|---|---|---|
|
require 'csv'
|
||
|
class Import < ActiveRecord::Base
|
||
|
class Import < ApplicationRecord
|
||
|
has_many :items, :class_name => 'ImportItem', :dependent => :delete_all
|
||
|
belongs_to :user
|
||
|
serialize :settings
|
||
| app/models/import_item.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class ImportItem < ActiveRecord::Base
|
||
|
class ImportItem < ApplicationRecord
|
||
|
belongs_to :import
|
||
|
validates_presence_of :import_id, :position
|
||
| app/models/issue.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Issue < ActiveRecord::Base
|
||
|
class Issue < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
include Redmine::Utils::DateCalculation
|
||
|
include Redmine::I18n
|
||
| app/models/issue_category.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class IssueCategory < ActiveRecord::Base
|
||
|
class IssueCategory < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :project
|
||
|
belongs_to :assigned_to, :class_name => 'Principal'
|
||
| app/models/issue_relation.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class IssueRelation < ActiveRecord::Base
|
||
|
class IssueRelation < ApplicationRecord
|
||
|
# Class used to represent the relations of an issue
|
||
|
class Relations < Array
|
||
|
include Redmine::I18n
|
||
| app/models/issue_status.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class IssueStatus < ActiveRecord::Base
|
||
|
class IssueStatus < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
before_destroy :check_integrity
|
||
| app/models/journal.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Journal < ActiveRecord::Base
|
||
|
class Journal < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :journalized, :polymorphic => true
|
||
| app/models/journal_detail.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class JournalDetail < ActiveRecord::Base
|
||
|
class JournalDetail < ApplicationRecord
|
||
|
belongs_to :journal
|
||
|
def custom_field
|
||
| app/models/member.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Member < ActiveRecord::Base
|
||
|
class Member < ApplicationRecord
|
||
|
belongs_to :user
|
||
|
belongs_to :principal, :foreign_key => 'user_id'
|
||
|
has_many :member_roles, :dependent => :destroy
|
||
| app/models/member_role.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class MemberRole < ActiveRecord::Base
|
||
|
class MemberRole < ApplicationRecord
|
||
|
belongs_to :member
|
||
|
belongs_to :role
|
||
| app/models/message.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Message < ActiveRecord::Base
|
||
|
class Message < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :board
|
||
|
belongs_to :author, :class_name => 'User'
|
||
| app/models/news.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class News < ActiveRecord::Base
|
||
|
class News < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :project
|
||
|
belongs_to :author, :class_name => 'User'
|
||
| app/models/principal.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Principal < ActiveRecord::Base
|
||
|
class Principal < ApplicationRecord
|
||
|
self.table_name = "#{table_name_prefix}users#{table_name_suffix}"
|
||
|
# Account statuses
|
||
| app/models/project.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Project < ActiveRecord::Base
|
||
|
class Project < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
include Redmine::NestedSet::ProjectNestedSet
|
||
| app/models/query.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
class Query < ActiveRecord::Base
|
||
|
class Query < ApplicationRecord
|
||
|
class StatementInvalid < ::ActiveRecord::StatementInvalid
|
||
|
end
|
||
| app/models/repository.rb | ||
|---|---|---|
|
class ScmFetchError < StandardError; end
|
||
|
class Repository < ActiveRecord::Base
|
||
|
class Repository < ApplicationRecord
|
||
|
include Redmine::Ciphering
|
||
|
include Redmine::SafeAttributes
|
||
| app/models/role.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Role < ActiveRecord::Base
|
||
|
class Role < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
# Custom coder for the permissions attribute that should be an
|
||
| app/models/setting.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Setting < ActiveRecord::Base
|
||
|
class Setting < ApplicationRecord
|
||
|
PASSWORD_CHAR_CLASSES = {
|
||
|
'uppercase' => /[A-Z]/,
|
||
|
'lowercase' => /[a-z]/,
|
||
| app/models/time_entry.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class TimeEntry < ActiveRecord::Base
|
||
|
class TimeEntry < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
# could have used polymorphic association
|
||
|
# project association here allows easy loading of time entries at project level with one database trip
|
||
| app/models/token.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Token < ActiveRecord::Base
|
||
|
class Token < ApplicationRecord
|
||
|
belongs_to :user
|
||
|
validates_uniqueness_of :value, :case_sensitive => true
|
||
| app/models/tracker.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Tracker < ActiveRecord::Base
|
||
|
class Tracker < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject is_private).freeze
|
||
| app/models/user_preference.rb | ||
|---|---|---|
|
require 'redmine/my_page'
|
||
|
class UserPreference < ActiveRecord::Base
|
||
|
class UserPreference < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :user
|
||
| app/models/version.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
class Version < ActiveRecord::Base
|
||
|
class Version < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
after_update :update_issues_from_sharing_change
|
||
| app/models/watcher.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Watcher < ActiveRecord::Base
|
||
|
class Watcher < ApplicationRecord
|
||
|
belongs_to :watchable, :polymorphic => true
|
||
|
belongs_to :user, :class_name => 'Principal'
|
||
| app/models/wiki.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class Wiki < ActiveRecord::Base
|
||
|
class Wiki < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :project
|
||
|
has_many :pages, lambda {order(Arel.sql('LOWER(title)').asc)}, :class_name => 'WikiPage', :dependent => :destroy
|
||
| app/models/wiki_content.rb | ||
|---|---|---|
|
require 'zlib'
|
||
|
class WikiContent < ActiveRecord::Base
|
||
|
class WikiContent < ApplicationRecord
|
||
|
self.locking_column = 'version'
|
||
|
belongs_to :page, :class_name => 'WikiPage'
|
||
|
belongs_to :author, :class_name => 'User'
|
||
| app/models/wiki_content_version.rb | ||
|---|---|---|
|
require 'zlib'
|
||
|
class WikiContentVersion < ActiveRecord::Base
|
||
|
class WikiContentVersion < ApplicationRecord
|
||
|
belongs_to :page, :class_name => 'WikiPage'
|
||
|
belongs_to :author, :class_name => 'User'
|
||
| app/models/wiki_page.rb | ||
|---|---|---|
|
require 'redmine/string_array_diff/diff'
|
||
|
class WikiPage < ActiveRecord::Base
|
||
|
class WikiPage < ApplicationRecord
|
||
|
include Redmine::SafeAttributes
|
||
|
belongs_to :wiki
|
||
| app/models/wiki_redirect.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class WikiRedirect < ActiveRecord::Base
|
||
|
class WikiRedirect < ApplicationRecord
|
||
|
belongs_to :wiki
|
||
|
validates_presence_of :wiki_id, :title, :redirects_to
|
||
| app/models/workflow_rule.rb | ||
|---|---|---|
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
class WorkflowRule < ActiveRecord::Base
|
||
|
class WorkflowRule < ApplicationRecord
|
||
|
self.table_name = "#{table_name_prefix}workflows#{table_name_suffix}"
|
||
|
belongs_to :role
|
||
| config/initializers/10-patches.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
module ActiveRecord
|
||
|
class Base
|
||
|
# Translate attribute names for validation errors display
|
||
|
def self.human_attribute_name(attr, options = {})
|
||
|
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
|
||
|
class_prefix = name.underscore.tr('/', '_')
|
||
|
redmine_default = [
|
||
|
:"field_#{class_prefix}_#{prepared_attr}",
|
||
|
:"field_#{prepared_attr}"
|
||
|
]
|
||
|
options[:default] = redmine_default + Array(options[:default])
|
||
|
super
|
||
|
end
|
||
|
end
|
||
|
# Undefines private Kernel#open method to allow using `open` scopes in models.
|
||
|
# See Defect #11545 (http://www.redmine.org/issues/11545) for details.
|
||
|
class Base
|
||
| extra/sample_plugin/app/models/meeting.rb | ||
|---|---|---|
|
class Meeting < ActiveRecord::Base
|
||
|
class Meeting < ApplicationRecord
|
||
|
belongs_to :project
|
||
|
acts_as_event :title => Proc.new {|o| "#{o.scheduled_on} Meeting"},
|
||
| lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb | ||
|---|---|---|
|
end
|
||
|
def parent_class_name
|
||
|
options[:parent] || "ActiveRecord::Base"
|
||
|
options[:parent] || "ApplicationRecord"
|
||
|
end
|
||
|
end
|
||
| lib/plugins/acts_as_activity_provider/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
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
|
||
| lib/plugins/acts_as_attachable/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
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
|
||
| lib/plugins/acts_as_customizable/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
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
|
||
| lib/plugins/acts_as_event/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
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
|
||
| lib/plugins/acts_as_searchable/init.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
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
|
||
| lib/plugins/acts_as_tree/README | ||
|---|---|---|
|
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
|
||
| lib/plugins/acts_as_tree/init.rb | ||
|---|---|---|
|
# 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
|
||
| lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb | ||
|---|---|---|
|
# 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
|
||
|
#
|
||
| lib/plugins/acts_as_tree/test/acts_as_tree_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
class Mixin < ActiveRecord::Base
|
||
|
class Mixin < ApplicationRecord
|
||
|
end
|
||
|
class TreeMixin < Mixin
|
||
| lib/plugins/acts_as_watchable/init.rb | ||
|---|---|---|
|
# 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
|
||
| lib/plugins/gravatar/init.rb | ||
|---|---|---|
|
# 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
|
||
| lib/redmine/preparation.rb | ||
|---|---|---|
|
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"
|
||
| test/unit/initializers/patches_test.rb | ||
|---|---|---|
|
Setting.default_language = 'en'
|
||
|
end
|
||
|
test "ActiveRecord::Base.human_attribute_name should transform name to field_name" do
|
||
|
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on')
|
||
|
test "ApplicationRecord.human_attribute_name should transform name to field_name" do
|
||
|
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on')
|
||
|
end
|
||
|
test "ActiveRecord::Base.human_attribute_name should cut extra _id suffix for better validation" do
|
||
|
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on_id')
|
||
|
test "ApplicationRecord.human_attribute_name should cut extra _id suffix for better validation" do
|
||
|
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on_id')
|
||
|
end
|
||
|
test "ActiveRecord::Base.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
|
||
|
assert_equal 'Patch name', ActiveRecord::Base.human_attribute_name('Patch name')
|
||
|
test "ApplicationRecord.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
|
||
|
assert_equal 'Patch name', ApplicationRecord.human_attribute_name('Patch name')
|
||
|
end
|
||
|
test 'ActionView::Helpers::FormHelper.date_field should add max=9999-12-31 to limit year value to 4 digits by default' do
|
||