Apply Rails/InverseOf rubocop rule
Not doing so has a few gotchas when working with relations, particularly with records which are not stored in the database. I'm excluding the related content file because it's got a very peculiar relationship with itself: the `has_one :opposite_related_content` has no inverse; the relation itself is its inverse. It's a false positive since the inverse condition is true: ``` content.opposite_related_content.opposite_related_content.object_id == content.object_id ```
This commit is contained in:
@@ -19,10 +19,10 @@ class Legislation::Proposal < ApplicationRecord
|
||||
acts_as_votable
|
||||
acts_as_paranoid column: :hidden_at
|
||||
|
||||
belongs_to :process, foreign_key: "legislation_process_id"
|
||||
belongs_to :process, foreign_key: "legislation_process_id", inverse_of: :proposals
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", inverse_of: :legislation_proposals
|
||||
belongs_to :geozone
|
||||
has_many :comments, as: :commentable
|
||||
has_many :comments, as: :commentable, inverse_of: :commentable
|
||||
|
||||
validates :title, presence: true
|
||||
validates :summary, presence: true
|
||||
|
||||
Reference in New Issue
Block a user