Rails Action Text allows rich text content editing
via Basecamp’s Trix editor. Action Text manages the
rich text content configuring a Action Text to Active
Record model using has_rich_text
.
To configure Active Record model to associate
rich text, you need to configure has_rich_text
as follows in the model.
class Message < ApplicationRecord
has_rich_text :content
end
Today I learned, you can configure Action Text
rich text using Rails model and scaffold
generator by providing rich_text
field attribute.
The model and scaffold generator would configure
Active Record model with the
appropriate Action Text configuration.
Run the model generator as follows to configure
has_rich_text
for content
in the user model.
$ bin/rails generate model <ModelName> <association_name>:rich_text
Added documentation for same in the Rails guides: PR#42400
Happy Coding!!