Merge pull request #2378 from Br3nda/dev

Resolve dev conflicts
This commit is contained in:
Brenda Wallace
2020-01-14 12:27:22 +13:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ class Photo < ApplicationRecord
# This doesn't work, ActiveRecord tries to use the polymoriphinc photographable
# relationship instead.
# has_many :crops, through: :photo_associations
# has_many :crops, through: :photo_associations, counter_cache: true
def crops
Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: self })
end

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class PhotoAssociation < ApplicationRecord
belongs_to :photo, touch: true
belongs_to :photo, touch: true, inverse_of: :photo_associations
belongs_to :crop, optional: true, touch: true # , counter_cache: true
belongs_to :photographable, polymorphic: true, touch: true