Skip to content

Commit

Permalink
appease RubocopRails: Rails/RedundantForeignKey
Browse files Browse the repository at this point in the history
> Specifying the default value for foreign_key is redundant.

Apparently I didn't have to specify these foreign keys back when
RubocopRails barked about missing inverse relationships?

Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
robbkidd committed Jun 25, 2020
1 parent ca8ff6f commit 3dc8904
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/supermarket/app/models/cookbook.rb
Expand Up @@ -95,7 +95,7 @@ class Cookbook < ApplicationRecord
belongs_to :category, optional: true
belongs_to :owner, class_name: "User", foreign_key: :user_id, inverse_of: :owned_cookbooks
has_one :chef_account, through: :owner
belongs_to :replacement, class_name: "Cookbook", foreign_key: :replacement_id, inverse_of: :replaces, optional: true
belongs_to :replacement, class_name: "Cookbook", inverse_of: :replaces, optional: true
has_many :replaces, class_name: "Cookbook", foreign_key: :replacement_id, inverse_of: :replacement, dependent: :nullify
has_many :collaborators, as: :resourceable, inverse_of: :resourceable # rubocop:disable Rails/HasManyOrHasOneDependent
has_many :collaborator_users, through: :collaborators, source: :user
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/app/models/user.rb
Expand Up @@ -7,7 +7,7 @@ class User < ApplicationRecord
# Associations
# --------------------
has_many :accounts
has_many :owned_cookbooks, class_name: "Cookbook", foreign_key: "user_id", inverse_of: :owner
has_many :owned_cookbooks, class_name: "Cookbook", inverse_of: :owner
has_many :cookbook_versions
has_many :collaborators
has_many :cookbook_followers
Expand Down

0 comments on commit 3dc8904

Please sign in to comment.