The form is displayed correctly But when I try to load in the form description field, I get errors in the browser console
http://localhost:5000/rails/active_storage/direct_uploads
Uncaught Error: Direct upload failed: Error creating Blob for "image.png". Status: 404
directUploadDidComplete attachment_upload.js:23
node_modules vendors-node_modules_rails_actiontext_app_javascript_actiontext_index_js-node_modules_uppy_da-2fab39-b1e8fdc9a94887083e5c.js:787
requestDidError activestorage.js:599
requestDidLoad activestorage.js:593
attachment_upload.js:23
In my model file, I added
has_rich_text :description
The necessary tables are present
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false
t.text "body"
t.string "record_type", null: false
t.integer "record_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
end
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.bigint "record_id", null: false
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.string "service_name", null: false
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "active_storage_variant_records", force: :cascade do |t|
t.bigint "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
in applicatio.rb
require "active_storage/engine"
In Stimulus index.js is present
const Trix = require('trix')
import "@rails/actiontext"
Trix.config.blockAttributes.heading1.tagName = 'h3'
gemfile contains image_processing
gem "image_processing", ">= 1.10.3", "< 2"
ruby ">=3.0.0" gem "rails", "~> 6.1"
I tried updating and rewriting in a different way referring to the trix-attachment-add event, but I had no luck inserting this in the right place in the trix-editor.