I've followed the Rails Active Storage guide (https://guides.rubyonrails.org/active_storage_overview.html#direct-upload-javascript-events). But when I upload an image and click post, the text is saved while the image is not. I've checked all three tables (active_storage_attachments, etc.) and they are all empty. What could I be doing wrong?
view
<%= form_for([@book, @comment]) do |form| %>
<div>
<%= form.text_area :body, class:'', placeholder: 'name...'%>
</div>
<%= form.file_field :image, multiple: true, direct_upload: true %>
<div class="">
<%= form.submit "Done", class:''%>
</div>
application.js (the guide says to include activestorage.js in the javascript bundle, but I wasn't sure where that was in Rails 6. Also the code required seems to be already in this application.js, perhaps when I ran active storage install)
//= require activestorage
import Rails from "@rails/ujs"
import Turbolinks from "turbolinks"
import * as ActiveStorage from "@rails/activestorage"
import "channels"
Rails.start()
Turbolinks.start()
ActiveStorage.start()
model
has_many_attached :images
gemfile
gem "aws-sdk-s3", require: false
development.rb
config.active_storage.service = :local
multipart: trueto the form - arieljuod<%= image_tag(@comment.images) %>nor<%= url_for(@comment.images) %>works. For that I'll create another question if I can't resolve it on my onw. - amazingbot