Get plain text of rich text attribute in Rails
23 April 2022 (Updated 23 April 2022)
Suppose you have a Note
model with a rich text attribute named content
. If content
has the value Hello there
, and you run:
you’ll get a ActionText::RichText
instance:
To get the plain text version, you can use:
which will return:
Tagged:
Rails
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment