We have an ActiveRecord model with an html attribute (say Post#body
). Is there a nice way that calling body
on a post
returns an html_safe?
string? E.g.:
class Post < ActiveRecord::Base
# is_html_escaped :body or somesuch magic
end
Post.first.body.html_safe? # => true
The problem otherwise is that we have to call raw
everything we show that field.