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

There's a way to save a record with no attachment even with an attachment presence validation (using Trestle) #80

Open
gitjul opened this issue Sep 11, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@gitjul
Copy link

gitjul commented Sep 11, 2020

I ran into an issue when using active_storage_validations with Trestle (https://github.com/TrestleAdmin/trestle/trestle-active_storage) and with trestle-active_storage (https://github.com/richardvenneman/trestle-active_storage, wrote about the issue here: richardvenneman/trestle-active_storage#23) and I'm not sure which of the gems possibly "owns" the issue, so forgive me if I'm wrong to open this issue here.

I found that there's a way to save a record with no attachments even with a presence validation. The validation works if you're trying to save a newly added record and adding attachments for the first time (or rather not adding any and wanting to save the record). But when you successfully save a record, and then delete all the attachments and save, it's successfully saved, even though the record is invalid (and you can check that in rails console ofc with the_saved_record.valid?, which is false).

I haven't found an issue anywhere, could you tell me if this is something you know about if you know a fix/workaround? Also let me know if this is not the right place for this issue. Thx!

PS Huge thank you for this gem <3 💎

PS thanks for the gem! 💎

@gitjul gitjul changed the title There's a way to save a record with attachment presence validation (using Trestle) There's a way to save a record with no attachment even with an attachment presence validation (using Trestle) Sep 11, 2020
@igorkasyanchuk
Copy link
Owner

@gitjul if possible, please replicate with test inside test/dummy app in this gem

if you can make a test which fails it would be a nice start point to fix this issue

sorry but I need support from you too :)

@gitjul
Copy link
Author

gitjul commented Sep 11, 2020

@igorkasyanchuk sure, no time now but I'll try when I have some

@igorkasyanchuk igorkasyanchuk added the help wanted Extra attention is needed label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants