You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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! 💎
The text was updated successfully, but these errors were encountered:
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
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 isfalse
).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! 💎
The text was updated successfully, but these errors were encountered: