From d456d045cd42cec1cd91b56e504a538fdeb54ea3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 3 Jan 2018 17:24:51 +1300 Subject: [PATCH] Changed order of photo association relationship declarations --- app/models/concerns/photo_capable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/photo_capable.rb b/app/models/concerns/photo_capable.rb index 177a2f832..758569c35 100644 --- a/app/models/concerns/photo_capable.rb +++ b/app/models/concerns/photo_capable.rb @@ -2,8 +2,8 @@ module PhotoCapable extend ActiveSupport::Concern included do - has_many :photos, through: :photographings, as: :photographable has_many :photographings, as: :photographable, dependent: :destroy + has_many :photos, through: :photographings, as: :photographable scope :has_photos, -> { includes(:photos).where.not(photos: { id: nil }) } end