Reputation: 345
I have a model called Answer
that can have many attachments. I have specified it as has_many_attached :answer_files
and permitted the parameter as per the docs however in this model I keep getting Unpermitted parameter: :#<ActiveStorage::Attached::Many:0x0000000012e76aa0>
in the logs. I have the same in another model using has_one_attached :logo
and that works fine.
Do note that I am using direct_upload: true
as per the docs in both models. What I do not understand is that the record does save and the files are being added to the active_storage_blobs table. It is just not being associated with my model.
I have also tried to re-install active storage to no avail.
Appreciate any assistance.
Upvotes: 2
Views: 429
Reputation: 345
I managed to solve this with the assistance of u/endenis on Reddit. The answer is part of an association and I thought that I have to do it like this f.file_field answer.answer_files, multiple: true, direct_upload: true
but that is incorrect.
I had to do it this way f.file_field :answer_files, multiple: true, direct_upload: true
Upvotes: 2