Attributes_table 在 ActiveAdmin 中使用 Arbre 格式化

Attributes_table formatting using Arbre in ActiveAdmin

我正在向用户显示一个 ActiveAdmin 注册模型。

ActiveAdmin.register ConfigurationFile do
  show do
    attributes_table do
      row :name
      row :filename
      row :content
    end
  end
end

:content 是一个带有换行符的字符串,但当由 Arbre 渲染时,换行符和多余的空格会被删除。

如何在不删除额外的空格和换行符的情况下显示 :content

看看html_safe:

 show do |configuration_file|
   attributes_table do
     # other rows
     row 'Content' do
       configuration_file.content.html_safe
     end
   end
 end