Как отправить тело письма в тексте действия?
Post.rb
has_rich_text :body
after_create :send_email_to_current_user
def send_email_to_current_user
PostEmailer.create_post(current_user, self)
end
PostEmailer.rb
def create_post(user, post)
email = user.email
body = post.body
mail(to: email, subject: 'create post', body: body)
end
Я ожидал, что body - это строка, но я получил тело action_text в объекте вроде
#<ActionText::RichText id: 12, name: "body", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 16, created_at: "2020-06-18 11:49:04", updated_at: "2020-06-18 11:49:04">
Используя rails 6.0, Ruby 2.7.1