Trix
The Trix field renders a WYSIWYG editor and stores the resulting HTML in a string or text database column. It also supports ActiveStorage file attachments, ActionText, and the Media Library.
# app/avo/resources/post.rb
field :body, as: :trixBy default, the field is hidden on Index and shows a collapsed preview on Show. Attachments are enabled for Action Text attributes, but disabled for plain columns unless configured otherwise.

For shared settings such as visibility, placeholder text, and read-only behavior, see Common field options.
Show the full content
If you want the full content visible on Show without an expand link, set always_show to true.
# app/avo/resources/post.rb
field :body, as: :trix, always_show: trueAttach files to a saved record
WARNING
You must manually require the activestorage and image_processing gems in your Gemfile.
# Gemfile
gem "activestorage"
gem "image_processing"Trix supports drag-and-drop file attachments. If you store HTML in a plain column and want uploads attached to the record through Active Storage, set attachment_key to the name of the model's attachment association.
# app/avo/resources/post.rb
field :body, as: :trix, attachment_key: :trix_attachmentsDeclare the matching association on the model:
# app/models/post.rb
class Post < ApplicationRecord
has_many_attached :trix_attachments
endNow, when you upload a file in the Trix field, Avo will create an Active Record attachment. Because the file is attached to the record, uploads with an attachment_key work only once the record is saved.
Attachments without an attachment_key
On a plain column you can also enable attachments without an association. Avo uploads the file to Active Storage and stores its URL in the HTML, without attaching it to the record. This works on the New form too.
# app/avo/resources/post.rb
field :body, as: :trix, attachments_disabled: falseWARNING
These blobs aren't attached to any record, so a job that purges unattached blobs (ActiveStorage::Blob.unattached) deletes them.
Disable attachments
If you want a text-only editor, set attachments_disabled to true. This hides the attachments button (paperclip icon) and rejects file drops.
# app/avo/resources/post.rb
field :body, as: :trix, attachments_disabled: trueRemove attachment attributes
If you do not want attachment metadata in the document, use hide_attachment_filename, hide_attachment_filesize, and hide_attachment_url.
# app/avo/resources/post.rb
field :body, as: :trix,
attachment_key: :trix_attachments,
hide_attachment_filename: true,
hide_attachment_filesize: true,
hide_attachment_url: trueActive Storage
For plain database columns, use Active Storage either with a record association or without an association.
Use Action Text
If your model uses Action Text, declare its rich text attribute and use the same name for the Trix field. No attachment_key is required.
# app/models/post.rb
class Post < ApplicationRecord
has_rich_text :body
endUploads work on the New form, before the record is saved, and any file type is stored as an Action Text attachment. Avo renders those attachments with your app's active_storage/blobs/_blob.html.erb partial, just like your app does.
Demo app
We prepared a demo to showcase Trix's abilities to work with Action Text and Active Storage.
Translate upload alerts
You can customize the javascript alert messages for various actions in the Trix editor. Below are the default messages that can be translated or modified:
# config/locales/avo.en.yml
en:
avo:
this_field_has_attachments_disabled: This field has attachments disabled.
you_cant_upload_new_resource: You can't upload files into the Trix editor until you save the resource.Refer to the default for more details.