Apply Rails/HasAndBelongsToMany rubocop rule

We were using it everywhere except in one place.
This commit is contained in:
Javi Martín
2019-10-25 03:13:17 +02:00
parent 42d2e5b3ad
commit 1da0fe1ee2
4 changed files with 9 additions and 4 deletions

View File

@@ -15,9 +15,6 @@ Performance/EndWith:
Performance/StartWith:
Enabled: true
Rails/HasAndBelongsToMany:
Enabled: true
Rails/HasManyOrHasOneDependent:
Enabled: true

View File

@@ -206,6 +206,9 @@ Rails/FindEach:
Rails/HttpPositionalArguments:
Enabled: true
Rails/HasAndBelongsToMany:
Enabled: true
Rails/InverseOf:
Enabled: true
Exclude:

View File

@@ -0,0 +1,4 @@
class GeozonesPoll < ApplicationRecord
belongs_to :geozone
belongs_to :poll
end

View File

@@ -27,7 +27,8 @@ class Poll < ApplicationRecord
has_many :comments, as: :commentable, inverse_of: :commentable
has_many :ballot_sheets
has_and_belongs_to_many :geozones
has_many :geozones_polls
has_many :geozones, through: :geozones_polls
belongs_to :author, -> { with_hidden }, class_name: "User", inverse_of: :polls
belongs_to :related, polymorphic: true
belongs_to :budget