I am trying to implement multiple files upload using polymorphic association and Shrine.
class Campaign < ApplicationRecord
has_many :photos, as: :imageable, dependent: :destroy
accepts_nested_attributes_for :photos, allow_destroy: true
end
class Photo < ApplicationRecord
include ImageUploader::Attachment.new(:image)
belongs_to :imageable, polymorphic: true
end
I am able to save the photos after going through the docs.
Please advise how to validate uniqueness of image in scope of imageable.
I know that a signature could be generated per original version, but is it a right way to go?
Thanks.