0e76553934
49bcb00 has changed to maintain extra joins only if other table's condition is found (e.g. `other_table[:id].eq(table[:foreign_id])`). It means that cannot maintain extra joins for complex conditions (especially "(... OR ...)"), so it has caused a regression #37167. This changes to maintain extra joins for complex conditions too like as before. Fixes #37167.
9 lines
410 B
Ruby
9 lines
410 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Rating < ActiveRecord::Base
|
|
belongs_to :comment
|
|
has_many :taggings, as: :taggable
|
|
has_many :taggings_without_tag, -> { left_joins(:tag).where("tags.id": [nil, 0]) }, as: :taggable, class_name: "Tagging"
|
|
has_many :taggings_with_no_tag, -> { joins("LEFT OUTER JOIN tags ON tags.id = taggings.tag_id").where("tags.id": nil) }, as: :taggable, class_name: "Tagging"
|
|
end
|