0

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

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

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

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

4

1 回答 1

1

看看html_safe

 show do |configuration_file|
   attributes_table do
     # other rows
     row 'Content' do
       configuration_file.content.html_safe
     end
   end
 end
于 2015-01-22T18:47:34.770 回答