ActiveStorage trix image before record exist.
Hi,
I have a Concept model with description string field.
Concept has_many_attached :images
, I use them to store images that I dragged into trix wysiwyg.
Everything works great if Concept already exist and I edit it.
My goal is to give user option to upload images right on creation step.
I have in mind some options:
- store images in other temporary record, and rewrite after save ( the worst one);
- pre save record in background while user fill ing form (should delete it if he cancel action, ghost records possible);
- do not allow editing description on creation step (easiest option, but does not meet expectation).
Will appreciate any ideas.
Thx.
I would probably recommend the middle option. One improvement you can make on that rather than deleting if the user cancels is to just have an idea of a "draft" record.
This would be a record you're editing but haven't fully published yet. It would only be visible to you and that way your images are attached to this record and you can safely delete them.
That helps in a lot of ways and also makes it so the user doesn't lose any progress as well which can be nice.
Forgot to mention, this is what Basecamp does when you create like a new Message. Same concept as writing a draft email in GMail too.
Adding this to my list for a screencast. 😜