rails-action-text
Installation
SKILL.md
Rails Action Text
Rich Text Usage
- Use
has_rich_text :fieldfor storing long-form or formatted content - Avoid storing raw HTML in plain string columns
- Use
.to_plain_textor.to_trix_htmlwhen rendering or indexing rich content - Validate presence on the virtual attribute:
validates :body, presence: true
Embeds vs Attachments
- Attachments are files/media associated with the model
- Embeds are inline references within the rich text content
- Use
record.body.attachablesto retrieve embedded models - Use
ActionText::Attachable.from_attachable(record)to generate embeds - Don't manually serialize
attachable_sgidunless you fully control the context