Patch #38975 » 38975-v2.patch
.rubocop.yml | ||
---|---|---|
129 | 129 |
# TODO: Need to check the impact on plugins. Disable for now. |
130 | 130 |
- 'lib/redmine/preparation.rb' |
131 | 131 | |
132 |
Rails/ApplicationRecord: |
|
133 |
Exclude: |
|
134 |
- 'db/migrate/0*.rb' |
|
135 | ||
132 | 136 |
Rails/BulkChangeTable: |
133 | 137 |
Exclude: |
134 | 138 |
- 'db/migrate/20120714122200_add_workflows_rule_fields.rb' |
.rubocop_todo.yml | ||
---|---|---|
497 | 497 |
- 'app/models/mail_handler.rb' |
498 | 498 |
- 'app/models/mailer.rb' |
499 | 499 | |
500 |
# This cop supports unsafe autocorrection (--autocorrect-all). |
|
501 |
Rails/ApplicationRecord: |
|
502 |
Enabled: false |
|
503 | ||
504 | 500 |
# This cop supports safe autocorrection (--autocorrect). |
505 | 501 |
# Configuration parameters: Include. |
506 | 502 |
# Include: **/test/**/* |
app/controllers/watchers_controller.rb | ||
---|---|---|
209 | 209 |
nil |
210 | 210 |
end |
211 | 211 |
return unless klass && Class === klass # rubocop:disable Style/CaseEquality |
212 |
return unless klass < ActiveRecord::Base
|
|
212 |
return unless klass < ApplicationRecord
|
|
213 | 213 |
return unless klass < Redmine::Acts::Watchable::InstanceMethods |
214 | 214 | |
215 | 215 |
scope = klass.where(:id => Array.wrap(params[:object_id])) |
app/models/attachment.rb | ||
---|---|---|
21 | 21 |
require "fileutils" |
22 | 22 |
require "zip" |
23 | 23 | |
24 |
class Attachment < ActiveRecord::Base
|
|
24 |
class Attachment < ApplicationRecord
|
|
25 | 25 |
include Redmine::SafeAttributes |
26 | 26 |
belongs_to :container, :polymorphic => true |
27 | 27 |
belongs_to :author, :class_name => "User" |
app/models/auth_source.rb | ||
---|---|---|
22 | 22 |
class AuthSourceException < StandardError; end |
23 | 23 |
class AuthSourceTimeoutException < AuthSourceException; end |
24 | 24 | |
25 |
class AuthSource < ActiveRecord::Base
|
|
25 |
class AuthSource < ApplicationRecord
|
|
26 | 26 |
include Redmine::SafeAttributes |
27 | 27 |
include Redmine::SubclassFactory |
28 | 28 |
include Redmine::Ciphering |
app/models/board.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Board < ActiveRecord::Base
|
|
20 |
class Board < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :project |
23 | 23 |
has_many :messages, lambda {order("#{Message.table_name}.created_on DESC")}, :dependent => :destroy |
app/models/change.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Change < ActiveRecord::Base
|
|
20 |
class Change < ApplicationRecord
|
|
21 | 21 |
belongs_to :changeset |
22 | 22 | |
23 | 23 |
validates_presence_of :changeset_id, :action, :path |
app/models/changeset.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Changeset < ActiveRecord::Base
|
|
20 |
class Changeset < ApplicationRecord
|
|
21 | 21 |
belongs_to :repository |
22 | 22 |
belongs_to :user |
23 | 23 |
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all |
app/models/comment.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Comment < ActiveRecord::Base
|
|
20 |
class Comment < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :commented, :polymorphic => true, :counter_cache => true |
23 | 23 |
belongs_to :author, :class_name => 'User' |
app/models/custom_field.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class CustomField < ActiveRecord::Base
|
|
20 |
class CustomField < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
include Redmine::SubclassFactory |
23 | 23 |
app/models/custom_field_enumeration.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class CustomFieldEnumeration < ActiveRecord::Base
|
|
20 |
class CustomFieldEnumeration < ApplicationRecord
|
|
21 | 21 |
belongs_to :custom_field |
22 | 22 | |
23 | 23 |
validates_presence_of :name, :position, :custom_field_id |
app/models/custom_value.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class CustomValue < ActiveRecord::Base
|
|
20 |
class CustomValue < ApplicationRecord
|
|
21 | 21 |
belongs_to :custom_field |
22 | 22 |
belongs_to :customized, :polymorphic => true |
23 | 23 |
app/models/document.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Document < ActiveRecord::Base
|
|
20 |
class Document < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :project |
23 | 23 |
belongs_to :category, :class_name => "DocumentCategory" |
app/models/email_address.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class EmailAddress < ActiveRecord::Base
|
|
20 |
class EmailAddress < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 | 23 |
belongs_to :user |
app/models/enabled_module.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class EnabledModule < ActiveRecord::Base
|
|
20 |
class EnabledModule < ApplicationRecord
|
|
21 | 21 |
belongs_to :project |
22 | 22 |
acts_as_watchable |
23 | 23 |
app/models/enumeration.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Enumeration < ActiveRecord::Base
|
|
20 |
class Enumeration < ApplicationRecord
|
|
21 | 21 |
include Redmine::SubclassFactory |
22 | 22 | |
23 | 23 |
default_scope lambda {order(:position)} |
app/models/import.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
require 'csv' |
21 | 21 | |
22 |
class Import < ActiveRecord::Base
|
|
22 |
class Import < ApplicationRecord
|
|
23 | 23 |
has_many :items, :class_name => 'ImportItem', :dependent => :delete_all |
24 | 24 |
belongs_to :user |
25 | 25 |
serialize :settings |
app/models/import_item.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class ImportItem < ActiveRecord::Base
|
|
20 |
class ImportItem < ApplicationRecord
|
|
21 | 21 |
belongs_to :import |
22 | 22 | |
23 | 23 |
validates_presence_of :import_id, :position |
app/models/issue.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Issue < ActiveRecord::Base
|
|
20 |
class Issue < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
include Redmine::Utils::DateCalculation |
23 | 23 |
include Redmine::I18n |
app/models/issue_category.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class IssueCategory < ActiveRecord::Base
|
|
20 |
class IssueCategory < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :project |
23 | 23 |
belongs_to :assigned_to, :class_name => 'Principal' |
app/models/issue_relation.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class IssueRelation < ActiveRecord::Base
|
|
20 |
class IssueRelation < ApplicationRecord
|
|
21 | 21 |
# Class used to represent the relations of an issue |
22 | 22 |
class Relations < Array |
23 | 23 |
include Redmine::I18n |
app/models/issue_status.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class IssueStatus < ActiveRecord::Base
|
|
20 |
class IssueStatus < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 | 23 |
before_destroy :check_integrity |
app/models/journal.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Journal < ActiveRecord::Base
|
|
20 |
class Journal < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 | 23 |
belongs_to :journalized, :polymorphic => true |
app/models/journal_detail.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class JournalDetail < ActiveRecord::Base
|
|
20 |
class JournalDetail < ApplicationRecord
|
|
21 | 21 |
belongs_to :journal |
22 | 22 | |
23 | 23 |
def custom_field |
app/models/member.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Member < ActiveRecord::Base
|
|
20 |
class Member < ApplicationRecord
|
|
21 | 21 |
belongs_to :user |
22 | 22 |
belongs_to :principal, :foreign_key => 'user_id' |
23 | 23 |
has_many :member_roles, :dependent => :destroy |
app/models/member_role.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class MemberRole < ActiveRecord::Base
|
|
20 |
class MemberRole < ApplicationRecord
|
|
21 | 21 |
belongs_to :member |
22 | 22 |
belongs_to :role |
23 | 23 |
app/models/message.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Message < ActiveRecord::Base
|
|
20 |
class Message < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :board |
23 | 23 |
belongs_to :author, :class_name => 'User' |
app/models/news.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class News < ActiveRecord::Base
|
|
20 |
class News < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :project |
23 | 23 |
belongs_to :author, :class_name => 'User' |
app/models/principal.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Principal < ActiveRecord::Base
|
|
20 |
class Principal < ApplicationRecord
|
|
21 | 21 |
self.table_name = "#{table_name_prefix}users#{table_name_suffix}" |
22 | 22 | |
23 | 23 |
# Account statuses |
app/models/project.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Project < ActiveRecord::Base
|
|
20 |
class Project < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
include Redmine::NestedSet::ProjectNestedSet |
23 | 23 |
app/models/query.rb | ||
---|---|---|
239 | 239 |
end |
240 | 240 |
end |
241 | 241 | |
242 |
class Query < ActiveRecord::Base
|
|
242 |
class Query < ApplicationRecord
|
|
243 | 243 |
class StatementInvalid < ::ActiveRecord::StatementInvalid |
244 | 244 |
end |
245 | 245 |
app/models/repository.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
class ScmFetchError < StandardError; end |
21 | 21 | |
22 |
class Repository < ActiveRecord::Base
|
|
22 |
class Repository < ApplicationRecord
|
|
23 | 23 |
include Redmine::Ciphering |
24 | 24 |
include Redmine::SafeAttributes |
25 | 25 |
app/models/role.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Role < ActiveRecord::Base
|
|
20 |
class Role < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 | 23 |
# Custom coder for the permissions attribute that should be an |
app/models/setting.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Setting < ActiveRecord::Base
|
|
20 |
class Setting < ApplicationRecord
|
|
21 | 21 |
PASSWORD_CHAR_CLASSES = { |
22 | 22 |
'uppercase' => /[A-Z]/, |
23 | 23 |
'lowercase' => /[a-z]/, |
app/models/time_entry.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class TimeEntry < ActiveRecord::Base
|
|
20 |
class TimeEntry < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
# could have used polymorphic association |
23 | 23 |
# project association here allows easy loading of time entries at project level with one database trip |
app/models/token.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Token < ActiveRecord::Base
|
|
20 |
class Token < ApplicationRecord
|
|
21 | 21 |
belongs_to :user |
22 | 22 |
validates_uniqueness_of :value, :case_sensitive => true |
23 | 23 |
app/models/tracker.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Tracker < ActiveRecord::Base
|
|
20 |
class Tracker < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 | 23 |
CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject is_private).freeze |
app/models/user_preference.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
require 'redmine/my_page' |
21 | 21 | |
22 |
class UserPreference < ActiveRecord::Base
|
|
22 |
class UserPreference < ApplicationRecord
|
|
23 | 23 |
include Redmine::SafeAttributes |
24 | 24 | |
25 | 25 |
belongs_to :user |
app/models/version.rb | ||
---|---|---|
108 | 108 |
end |
109 | 109 |
end |
110 | 110 | |
111 |
class Version < ActiveRecord::Base
|
|
111 |
class Version < ApplicationRecord
|
|
112 | 112 |
include Redmine::SafeAttributes |
113 | 113 | |
114 | 114 |
after_update :update_issues_from_sharing_change |
app/models/watcher.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Watcher < ActiveRecord::Base
|
|
20 |
class Watcher < ApplicationRecord
|
|
21 | 21 |
belongs_to :watchable, :polymorphic => true |
22 | 22 |
belongs_to :user, :class_name => 'Principal' |
23 | 23 |
app/models/wiki.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class Wiki < ActiveRecord::Base
|
|
20 |
class Wiki < ApplicationRecord
|
|
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 |
belongs_to :project |
23 | 23 |
has_many :pages, lambda {order(Arel.sql('LOWER(title)').asc)}, :class_name => 'WikiPage', :dependent => :destroy |
app/models/wiki_content.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
require 'zlib' |
21 | 21 | |
22 |
class WikiContent < ActiveRecord::Base
|
|
22 |
class WikiContent < ApplicationRecord
|
|
23 | 23 |
self.locking_column = 'version' |
24 | 24 |
belongs_to :page, :class_name => 'WikiPage' |
25 | 25 |
belongs_to :author, :class_name => 'User' |
app/models/wiki_content_version.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
require 'zlib' |
21 | 21 | |
22 |
class WikiContentVersion < ActiveRecord::Base
|
|
22 |
class WikiContentVersion < ApplicationRecord
|
|
23 | 23 |
belongs_to :page, :class_name => 'WikiPage' |
24 | 24 |
belongs_to :author, :class_name => 'User' |
25 | 25 |
app/models/wiki_page.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
require 'redmine/string_array_diff/diff' |
21 | 21 | |
22 |
class WikiPage < ActiveRecord::Base
|
|
22 |
class WikiPage < ApplicationRecord
|
|
23 | 23 |
include Redmine::SafeAttributes |
24 | 24 | |
25 | 25 |
belongs_to :wiki |
app/models/wiki_redirect.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class WikiRedirect < ActiveRecord::Base
|
|
20 |
class WikiRedirect < ApplicationRecord
|
|
21 | 21 |
belongs_to :wiki |
22 | 22 | |
23 | 23 |
validates_presence_of :wiki_id, :title, :redirects_to |
app/models/workflow_rule.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
class WorkflowRule < ActiveRecord::Base
|
|
20 |
class WorkflowRule < ApplicationRecord
|
|
21 | 21 |
self.table_name = "#{table_name_prefix}workflows#{table_name_suffix}" |
22 | 22 | |
23 | 23 |
belongs_to :role |
config/initializers/10-patches.rb | ||
---|---|---|
1 | 1 |
# frozen_string_literal: true |
2 | 2 | |
3 | 3 |
module ActiveRecord |
4 |
class Base |
|
5 |
# Translate attribute names for validation errors display |
|
6 |
def self.human_attribute_name(attr, options = {}) |
|
7 |
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '') |
|
8 |
class_prefix = name.underscore.tr('/', '_') |
|
9 | ||
10 |
redmine_default = [ |
|
11 |
:"field_#{class_prefix}_#{prepared_attr}", |
|
12 |
:"field_#{prepared_attr}" |
|
13 |
] |
|
14 | ||
15 |
options[:default] = redmine_default + Array(options[:default]) |
|
16 | ||
17 |
super |
|
18 |
end |
|
19 |
end |
|
20 | ||
21 | 4 |
# Undefines private Kernel#open method to allow using `open` scopes in models. |
22 | 5 |
# See Defect #11545 (http://www.redmine.org/issues/11545) for details. |
23 | 6 |
class Base |
extra/sample_plugin/app/models/meeting.rb | ||
---|---|---|
1 |
class Meeting < ActiveRecord::Base
|
|
1 |
class Meeting < ApplicationRecord
|
|
2 | 2 |
belongs_to :project |
3 | 3 | |
4 | 4 |
acts_as_event :title => Proc.new {|o| "#{o.scheduled_on} Meeting"}, |
lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb | ||
---|---|---|
63 | 63 |
end |
64 | 64 | |
65 | 65 |
def parent_class_name |
66 |
options[:parent] || "ActiveRecord::Base"
|
|
66 |
options[:parent] || "ApplicationRecord"
|
|
67 | 67 |
end |
68 | 68 |
end |
lib/plugins/acts_as_activity_provider/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/acts_as_activity_provider' |
21 |
ActiveRecord::Base.send(:include, Redmine::Acts::ActivityProvider) |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send(:include, Redmine::Acts::ActivityProvider) |
|
23 |
end |
lib/plugins/acts_as_attachable/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/acts_as_attachable' |
21 |
ActiveRecord::Base.send(:include, Redmine::Acts::Attachable) |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send(:include, Redmine::Acts::Attachable) |
|
23 |
end |
lib/plugins/acts_as_customizable/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/acts_as_customizable' |
21 |
ActiveRecord::Base.send(:include, Redmine::Acts::Customizable) |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send(:include, Redmine::Acts::Customizable) |
|
23 |
end |
lib/plugins/acts_as_event/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/acts_as_event' |
21 |
ActiveRecord::Base.send(:include, Redmine::Acts::Event) |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send(:include, Redmine::Acts::Event) |
|
23 |
end |
lib/plugins/acts_as_searchable/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/acts_as_searchable' |
21 |
ActiveRecord::Base.send(:include, Redmine::Acts::Searchable) |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send(:include, Redmine::Acts::Searchable) |
|
23 |
end |
lib/plugins/acts_as_tree/README | ||
---|---|---|
4 | 4 |
Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children |
5 | 5 |
association. This requires that you have a foreign key column, which by default is called +parent_id+. |
6 | 6 | |
7 |
class Category < ActiveRecord::Base
|
|
7 |
class Category < ApplicationRecord
|
|
8 | 8 |
acts_as_tree :order => "name" |
9 | 9 |
end |
10 | 10 |
lib/plugins/acts_as_tree/init.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require_relative 'lib/active_record/acts/tree' |
21 |
ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree |
|
21 |
Rails.application.reloader.to_prepare do |
|
22 |
ApplicationRecord.send :include, ActiveRecord::Acts::Tree |
|
23 |
end |
lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb | ||
---|---|---|
27 | 27 |
# Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children |
28 | 28 |
# association. This requires that you have a foreign key column, which by default is called +parent_id+. |
29 | 29 |
# |
30 |
# class Category < ActiveRecord::Base
|
|
30 |
# class Category < ApplicationRecord
|
|
31 | 31 |
# acts_as_tree :order => "name" |
32 | 32 |
# end |
33 | 33 |
# |
lib/plugins/acts_as_tree/test/acts_as_tree_test.rb | ||
---|---|---|
59 | 59 |
end |
60 | 60 |
end |
61 | 61 | |
62 |
class Mixin < ActiveRecord::Base
|
|
62 |
class Mixin < ApplicationRecord
|
|
63 | 63 |
end |
64 | 64 | |
65 | 65 |
class TreeMixin < Mixin |
lib/plugins/acts_as_watchable/init.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
# Include hook code here |
21 | 21 |
require_relative 'lib/acts_as_watchable' |
22 |
ActiveRecord::Base.send(:include, Redmine::Acts::Watchable) |
|
22 |
Rails.application.reloader.to_prepare do |
|
23 |
ApplicationRecord.send(:include, Redmine::Acts::Watchable) |
|
24 |
end |
lib/plugins/gravatar/init.rb | ||
---|---|---|
1 | 1 |
# frozen_string_literal: true |
2 | 2 | |
3 | 3 |
require_relative 'lib/gravatar' |
4 |
ActionView::Base.send :include, GravatarHelper::PublicMethods |
|
4 |
Rails.application.reloader.to_prepare do |
|
5 |
ApplicationRecord.send :include, GravatarHelper::PublicMethods |
|
6 |
end |
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::Acts::Mentionable
|
|
25 |
ActiveRecord::Base.include Redmine::I18n
|
|
23 |
ApplicationRecord.include Redmine::Acts::Positioned
|
|
24 |
ApplicationRecord.include Redmine::Acts::Mentionable
|
|
25 |
ApplicationRecord.include Redmine::I18n
|
|
26 | 26 | |
27 | 27 |
Scm::Base.add "Subversion" |
28 | 28 |
Scm::Base.add "Mercurial" |
test/unit/initializers/patches_test.rb | ||
---|---|---|
27 | 27 |
Setting.default_language = 'en' |
28 | 28 |
end |
29 | 29 | |
30 |
test "ActiveRecord::Base.human_attribute_name should transform name to field_name" do
|
|
31 |
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on')
|
|
30 |
test "ApplicationRecord.human_attribute_name should transform name to field_name" do
|
|
31 |
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on')
|
|
32 | 32 |
end |
33 | 33 | |
34 |
test "ActiveRecord::Base.human_attribute_name should cut extra _id suffix for better validation" do
|
|
35 |
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on_id')
|
|
34 |
test "ApplicationRecord.human_attribute_name should cut extra _id suffix for better validation" do
|
|
35 |
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on_id')
|
|
36 | 36 |
end |
37 | 37 | |
38 |
test "ActiveRecord::Base.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
|
|
39 |
assert_equal 'Patch name', ActiveRecord::Base.human_attribute_name('Patch name')
|
|
38 |
test "ApplicationRecord.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
|
|
39 |
assert_equal 'Patch name', ApplicationRecord.human_attribute_name('Patch name')
|
|
40 | 40 |
end |
41 | 41 | |
42 | 42 |
test 'ActionView::Helpers::FormHelper.date_field should add max=9999-12-31 to limit year value to 4 digits by default' do |
- « Previous
- 1
- 2
- Next »