Fixed rubocop complains by restoring the deactivation of Rails/InverseOf.

This commit is contained in:
Thorsten Eckel 2018-05-05 19:03:14 +02:00
parent 04055f7095
commit ddd7cb315a
8 changed files with 23 additions and 0 deletions

View file

@ -4,9 +4,12 @@ class History < ApplicationModel
include History::Assets
self.table_name = 'histories'
# rubocop:disable Rails/InverseOf
belongs_to :history_type, class_name: 'History::Type'
belongs_to :history_object, class_name: 'History::Object'
belongs_to :history_attribute, class_name: 'History::Attribute'
# rubocop:enable Rails/InverseOf
# the noop is needed since Layout/EmptyLines detects
# the block commend below wrongly as the measurement of

View file

@ -1,8 +1,11 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Link < ApplicationModel
# rubocop:disable Rails/InverseOf
belongs_to :link_type, class_name: 'Link::Type'
belongs_to :link_object, class_name: 'Link::Object'
# rubocop:enable Rails/InverseOf
after_destroy :touch_link_references

View file

@ -12,7 +12,10 @@ class Organization < ApplicationModel
include Organization::Assets
include Organization::Search
include Organization::SearchIndex
# rubocop:disable Rails/InverseOf
has_many :members, class_name: 'User'
# rubocop:enable Rails/InverseOf
before_create :domain_cleanup
before_update :domain_cleanup

View file

@ -4,8 +4,11 @@ require_dependency 'store/object'
require_dependency 'store/file'
class Store < ApplicationModel
# rubocop:disable Rails/InverseOf
belongs_to :store_object, class_name: 'Store::Object'
belongs_to :store_file, class_name: 'Store::File'
# rubocop:enable Rails/InverseOf
validates :filename, presence: true

View file

@ -1,8 +1,11 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Tag < ApplicationModel
# rubocop:disable Rails/InverseOf
belongs_to :tag_object, class_name: 'Tag::Object'
belongs_to :tag_item, class_name: 'Tag::Item'
# rubocop:enable Rails/InverseOf
# the noop is needed since Layout/EmptyLines detects
# the block commend below wrongly as the measurement of

View file

@ -57,6 +57,8 @@ class Ticket < ApplicationModel
belongs_to :organization
has_many :articles, class_name: 'Ticket::Article', after_add: :cache_update, after_remove: :cache_update, dependent: :destroy, inverse_of: :ticket
has_many :ticket_time_accounting, class_name: 'Ticket::TimeAccounting', dependent: :destroy, inverse_of: :ticket
# rubocop:disable Rails/InverseOf
belongs_to :state, class_name: 'Ticket::State'
belongs_to :priority, class_name: 'Ticket::Priority'
belongs_to :owner, class_name: 'User'
@ -65,6 +67,7 @@ class Ticket < ApplicationModel
belongs_to :updated_by, class_name: 'User'
belongs_to :create_article_type, class_name: 'Ticket::Article::Type'
belongs_to :create_article_sender, class_name: 'Ticket::Article::Sender'
# rubocop:enable Rails/InverseOf
self.inheritance_column = nil

View file

@ -11,11 +11,14 @@ class Ticket::Article < ApplicationModel
belongs_to :ticket
has_one :ticket_time_accounting, class_name: 'Ticket::TimeAccounting', foreign_key: :ticket_article_id, dependent: :destroy, inverse_of: :ticket_article
# rubocop:disable Rails/InverseOf
belongs_to :type, class_name: 'Ticket::Article::Type'
belongs_to :sender, class_name: 'Ticket::Article::Sender'
belongs_to :created_by, class_name: 'User'
belongs_to :updated_by, class_name: 'User'
belongs_to :origin_by, class_name: 'User'
# rubocop:enable Rails/InverseOf
before_create :check_subject, :check_body, :check_message_id_md5
before_update :check_subject, :check_body, :check_message_id_md5

View file

@ -2,8 +2,10 @@
class Ticket::State < ApplicationModel
include ChecksLatestChangeObserved
# rubocop:disable Rails/InverseOf
belongs_to :state_type, class_name: 'Ticket::StateType', inverse_of: :states
belongs_to :next_state, class_name: 'Ticket::State'
# rubocop:enable Rails/InverseOf
after_create :ensure_defaults
after_update :ensure_defaults