method

to_plain_text

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: RichText
to_plain_text() public

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!"
Show source
Register or log in to add new notes.