나는 편집증 보석을 사용하고 있으며 현재이 문제로 어려움을 겪고 있습니다. has_many
삭제 된 항목을 조인해야하지만 삭제 된 항목 만 반환합니다. 내 모델 : 나는 삭제 된 항목에 mailings
을 반환해야하는 중이에요낙서 젬 - 삭제 된 항목과 결합
class Mailing < ActiveRecord::Base
acts_as_paranoid
has_many :mailing_fields
has_many :fields, through: :mailing_fields
end
class MailingField < ActiveRecord::
belongs_to :mailing
belongs_to :field
end
class Field < ActiveRecord::Base
has_many :mailing_fields, dependent: :destroy
has_many :mailings, through: :mailing_fields
end
쿼리 :
Field.joins(:mailings).where('mailings.id = ?', mailing_id)