ruby-on-railsruby-on-rails-3activeadminarbre

Attributes_table formatting using Arbre in ActiveAdmin


I am displaying an ActiveAdmin registered model to the user.

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

:content is a string with newlines, but when rendered by Arbre newlines and extra whitespace are dropped.

How can I display :content without dropping extra whitespace and newlines?


Solution

  • Take a look at html_safe:

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