Helmut
Joined 8/12/2020
Helmut said over 3 years ago on Bulk Upload with Active Storage :
Thanks very much for this, it's very helpful to not have to worry about Rails forgetting what files have been uploaded in a form previously, and also having an easy way to delete uploads. 

 I'm a beginner and just wondering about the best way to  incorporate this approach into an existing form and model  (I'm creating Invoices and want the user to be able to attach scans of receipts in the Invoice form they're filling out, and be able to add new scans without having to upload existing ones again, and be able to delete any scans easily). I'm thinking of doing this using your approach to accepting nested attributes in my Invoice form with Stimulus JS (I got this from Episode 186, thanks!).  Does this sound like a reasonable approach? I already use it for adding Line Items in the Invoice, and it seems like the same concept would work with this approach to Active Storage uploads, since each uploaded is its own post. 

I guess I'm going to try it, unless  anyone has a better idea. Otherwise, I'm not sure how I would associate these Active Storage instances with a parent  (like Invoice, or Post, etc.) and doing it all in one convenient form.  

Thanks for the great episode!

 

Helmut said over 3 years ago on Autocomplete with StimulusJS :
Hi! Any advice how to troubleshoot the Stimulus controller not activating at all? I created the same sample app you used, and got things working fine, and as I type into the Author field, I can see Rails responding to the keypresses in the terminal log, and I can see the search results appear in the browser.

But then I tried to implement autocomplete in a bigger app I've been working on for a while, and it does NOT show any auto-complete results, and there's no activity in the Terminal logs when typing in the field. Makes me think that the Stimulus controller is not firing, but I'm not sure how to troubleshoot. I've double-checked all my code for errors, and found none.

One thing I wonder about is when I installed stimulus-autocomplete in this bigger project, yarn gave me a few errors/warnings (see below). Could it be that the stimulus controllers didn't install properly (I don't have much experience installing dependencies)? Any other suggestions for how to figure out why the Javascript is not responding to key inputs?

THANKS MUCH!



yarn add v1.22.5
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
warning np@6.5.0: The engine "git" appears to be invalid.
[3/4] 🔗  Linking dependencies...
warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] 🔨  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ stimulus-autocomplete@1.4.0
info All dependencies
└─ stimulus-autocomplete@1.4.0
✨  Done in 3.59s.