method

to_s

rails latest stable - Class: ActionText::RichText

Method not available on this version

This method is only available on newer versions. The first available version (v7.2.3) is shown here.

to_s
public

Safely transforms RichText into an HTML String.

message = Message.create!(content: "<h1>Funny times!</h1>")
message.content.to_s # => "<h1>Funny times!</h1>"

message = Message.create!(content: "<div onclick='action()'>safe<script>unsafe</script></div>")
message.content.to_s # => "<div>safeunsafe</div>"