How to customize one column and display remaining in activeadmin

Senthil picture Senthil · Jan 19, 2013 · Viewed 12.5k times · Source

I am using Active admin gem in my rails app. I added resources book which has 20 columns, now i need to customize only one column and print the remaining as it is. I tried below code

ActiveAdmin.register Book do
 index do
  column :description do 
    raw "<a class='view_description button'>View Description</a>"
  end
 end
end

but which hides all the columns and show only description. Any help will be useful.

Answer

krhorst picture krhorst · Apr 19, 2013

How about this?

ActiveAdmin.register Book do
  index do
    columns_to_exclude = ["name"]
    (Book.column_names - columns_to_exclude).each do |c|
      column c.to_sym
    end
    column :description do 
      raw "<a class='view_description button'>View Description</a>"
    end
   end
end