Remove unnecessary foreign_key options

When we specify `belongs_to :author`, ActiveRecord automatically uses
`author_id` as the foreign key.
This commit is contained in:
Javi Martín
2019-10-24 02:38:44 +02:00
parent 904917e568
commit fda53a0a2a
23 changed files with 26 additions and 26 deletions

View File

@@ -4,7 +4,7 @@ class Topic < ApplicationRecord
include Notifiable
belongs_to :community
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
belongs_to :author, -> { with_hidden }, class_name: "User"
has_many :comments, as: :commentable