instance method
to_plain_text
Ruby on Rails 7.1.6
Since v6.0.6Signature
to_plain_text()
Returns the body attribute as plain text with all HTML tags removed.
message = Message.create!(content: "<h1>Funny times!</h1>") message.content.to_plain_text # => "Funny times!"
Source
# File actiontext/app/models/action_text/rich_text.rb, line 37
def to_plain_text
body&.to_plain_text.to_s
end
Defined in actiontext/app/models/action_text/rich_text.rb line 37
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionText::RichText