Enable the Rails/InverseOf cop and add missing inverse_of
This commit is contained in:
parent
51aacabf13
commit
7e80b8a4dc
6 changed files with 11 additions and 11 deletions
|
@ -726,7 +726,7 @@ Rails/HttpStatus:
|
|||
Enabled: false
|
||||
|
||||
Rails/InverseOf:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Rails/LexicallyScopedActionFilter:
|
||||
Enabled: false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Champs::RepetitionChamp < Champ
|
||||
has_many :champs, -> { ordered }, foreign_key: :parent_id, dependent: :destroy
|
||||
has_many :champs, -> { ordered }, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
|
||||
|
||||
accepts_nested_attributes_for :champs, allow_destroy: true
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ class Dossier < ApplicationRecord
|
|||
has_many :champs_private, -> { root.private_only.ordered }, class_name: 'Champ', inverse_of: :dossier, dependent: :destroy
|
||||
has_many :commentaires, inverse_of: :dossier, dependent: :destroy
|
||||
has_many :invites, dependent: :destroy
|
||||
has_many :follows, -> { active }
|
||||
has_many :previous_follows, -> { inactive }, class_name: 'Follow'
|
||||
has_many :follows, -> { active }, inverse_of: :dossier
|
||||
has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :dossier
|
||||
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
|
||||
has_many :previous_followers_gestionnaires, -> { distinct }, through: :previous_follows, source: :gestionnaire
|
||||
has_many :avis, inverse_of: :dossier, dependent: :destroy
|
||||
|
|
|
@ -12,12 +12,12 @@ class Gestionnaire < ApplicationRecord
|
|||
has_many :assign_to, dependent: :destroy
|
||||
has_many :procedures, through: :assign_to
|
||||
|
||||
has_many :assign_to_with_email_notifications, -> { with_email_notifications }, class_name: 'AssignTo'
|
||||
has_many :assign_to_with_email_notifications, -> { with_email_notifications }, class_name: 'AssignTo', inverse_of: :gestionnaire
|
||||
has_many :procedures_with_email_notifications, through: :assign_to_with_email_notifications, source: :procedure
|
||||
|
||||
has_many :dossiers, -> { state_not_brouillon }, through: :procedures
|
||||
has_many :follows, -> { active }
|
||||
has_many :previous_follows, -> { inactive }, class_name: 'Follow'
|
||||
has_many :follows, -> { active }, inverse_of: :gestionnaire
|
||||
has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :gestionnaire
|
||||
has_many :followed_dossiers, through: :follows, source: :dossier
|
||||
has_many :previously_followed_dossiers, -> { distinct }, through: :previous_follows, source: :dossier
|
||||
has_many :avis
|
||||
|
|
|
@ -5,9 +5,9 @@ class Procedure < ApplicationRecord
|
|||
|
||||
MAX_DUREE_CONSERVATION = 36
|
||||
|
||||
has_many :types_de_piece_justificative, -> { ordered }, dependent: :destroy
|
||||
has_many :types_de_champ, -> { root.public_only.ordered }, dependent: :destroy
|
||||
has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', dependent: :destroy
|
||||
has_many :types_de_piece_justificative, -> { ordered }, inverse_of: :procedure, dependent: :destroy
|
||||
has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy
|
||||
has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', inverse_of: :procedure, dependent: :destroy
|
||||
has_many :dossiers, dependent: :restrict_with_exception
|
||||
has_many :deleted_dossiers, dependent: :destroy
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class TypeDeChamp < ApplicationRecord
|
|||
belongs_to :procedure
|
||||
|
||||
belongs_to :parent, class_name: 'TypeDeChamp'
|
||||
has_many :types_de_champ, -> { ordered }, foreign_key: :parent_id, class_name: 'TypeDeChamp', dependent: :destroy
|
||||
has_many :types_de_champ, -> { ordered }, foreign_key: :parent_id, class_name: 'TypeDeChamp', inverse_of: :parent, dependent: :destroy
|
||||
|
||||
store_accessor :options, :cadastres, :quartiers_prioritaires, :parcelles_agricoles, :old_pj
|
||||
delegate :tags_for_template, to: :dynamic_type
|
||||
|
|
Loading…
Reference in a new issue