class Rating < RivoApplicationRecord
self.primary_keys = :id, :shop_id
has_many_attached :images
...
end
Basically ActiveStoragepolymorphic table only supports one primary id under record_id for storage, but that's fine. We would just want to continue to record the :id instead of [:id, :shop_id]
At the moment, the fetching looks fine
# Rails Console
rating = Rating.first
rating.images.first
# ActiveStorage::Attachment Load (1.5ms)
# SELECT "active_storage_attachments".* FROM "active_storage_attachments"
# WHERE "active_storage_attachments"."record_id" = 1 AND "active_storage_attachments"."record_type" = 'Rating'
# AND "active_storage_attachments"."name" = 'images' ORDER BY "active_storage_attachments"."id" ASC LIMIT 1
However, the attach action can't seem to grep any :id correctly.
Hi @cfis, thanks for the nice gem.
Currently we have a simple setup
Basically
ActiveStorage
polymorphic table only supports one primary id underrecord_id
for storage, but that's fine. We would just want to continue to record the:id
instead of[:id, :shop_id]
At the moment, the fetching looks fine
However, the
attach
action can't seem to grep any:id
correctly.Thanks for you help!