From 243fde8c16a9894d6d0fc9d0e79799f7df407599 Mon Sep 17 00:00:00 2001 From: BrokenEagle Date: Sun, 19 Jul 2020 03:47:53 +0000 Subject: [PATCH] Fix includes not working in some cases - It was using the wrong field keys and erroring out --- app/models/tag_relationship.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/tag_relationship.rb b/app/models/tag_relationship.rb index 897894885..75d37571a 100644 --- a/app/models/tag_relationship.rb +++ b/app/models/tag_relationship.rb @@ -12,8 +12,8 @@ class TagRelationship < ApplicationRecord belongs_to :forum_topic, optional: true belongs_to :antecedent_tag, class_name: "Tag", foreign_key: "antecedent_name", primary_key: "name", default: -> { Tag.find_or_create_by_name(antecedent_name) } belongs_to :consequent_tag, class_name: "Tag", foreign_key: "consequent_name", primary_key: "name", default: -> { Tag.find_or_create_by_name(consequent_name) } - has_one :antecedent_wiki, through: :antecedent_tag, source: :wiki_page - has_one :consequent_wiki, through: :consequent_tag, source: :wiki_page + belongs_to :antecedent_wiki, class_name: "WikiPage", foreign_key: "antecedent_name", primary_key: "title", optional: true + belongs_to :consequent_wiki, class_name: "WikiPage", foreign_key: "antecedent_name", primary_key: "title", optional: true scope :active, -> {approved} scope :approved, -> {where(status: %w[active processing queued])}