Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with hash parameter for has_many_attached #7

Open
marktong11 opened this issue Dec 19, 2019 · 2 comments
Open

Issue with hash parameter for has_many_attached #7

marktong11 opened this issue Dec 19, 2019 · 2 comments

Comments

@marktong11
Copy link

marktong11 commented Dec 19, 2019

First of all, cool tool. One issue I am having is that has_many_attached does not currently work when specifying folder names.

send_zip {'Holidays in Lyon <3' => Holidays.where(place: 'lyon').first.pictures}

is currently giving an error NoMethodError: undefined method `filename' for #ActiveStorage::Attached::Many:0x00007fe05eef4818

This works though:

send_zip {'Holidays in Lyon <3' => Holidays.where(place: 'lyon').first.pictures.records}
@madeindjs
Copy link
Owner

Sorry for my late reply. Did you have this problem on current version ?

@robwold
Copy link

robwold commented Jun 1, 2023

I can confirm I've had the same problem on the current version. The above suggestion with records looks like it works (although for some reason I'm finding that image files are also getting corrupted by the zipping process 🤔 )

EDIT: I've had a poke around, and I think that the root of the issue is that ActiveStorage::Attached::Many responds false to .is_a? Array https://github.com/madeindjs/active_storage-send_zip/blob/master/lib/active_storage/send_zip_helper.rb#L41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants