instance method to_s

Ruby on Rails 8.0.4

Since v7.2.3

Available in: v7.2.3 v8.0.4 v8.1.2

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>"
Source
# File actiontext/app/models/action_text/rich_text.rb, line 39
    serialize :body, coder: ActionText::Content

Defined in actiontext/app/models/action_text/rich_text.rb line 39 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::RichText

Type at least 2 characters to search.

↑↓ navigate · open · esc close