Open 0000sir opened 1 year ago
The current releases of Rails (including 7.0.x) don't seem to play well with ActiveStorage when used from an engine. It looks like this may be fixed in 7.1 but in the mean time, you can add the following to your config/initializers/trestle.rb
:
config.helper do
delegate :rails_direct_uploads_url, to: :main_app
end
When rendering ActiveStorage files within the admin, you may also need to precede some route calls with main_app.
.
@spohlenz Thank you, direct upload works great (with trestle-active_storage Gem)! It's would be nice if this is documented.
Thank you for the great admin framework, but I have a tiny problem recently: Direct upload for active storage is not working, the option
direct_upload:true
didn't affect the html output, I followed codes in lib/trestle/form/fields/file_field.rb, and have no idea for this.I'm working with S3 protocol for active storage and direct upload works fine if I use it with scaffold controllers, Here's my code:
HTML generated:
Everything works except the _directupload option, What I'm missing?
Please help me with this, or I have to rewrite the hole admin panel myself.
Or, is there any other way to upload files in chunks?
Thank you very much.
BTW: trestle-active_storage Gem not help, seems like the _directupload was simply ignored