privacy_policy_serializer.rb 428 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. class REST::PrivacyPolicySerializer < ActiveModel::Serializer
  3. attributes :updated_at, :content
  4. def updated_at
  5. object.updated_at.iso8601
  6. end
  7. def content
  8. markdown.render(format(object.text, domain: Rails.configuration.x.local_domain))
  9. end
  10. private
  11. def markdown
  12. @markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, escape_html: true, no_images: true)
  13. end
  14. end