@@ -17,7 +17,7 @@ All resource index views will now include a link for download directly
1717to xls.
1818
1919``` ruby
20- gem ' activeadmin-xls' , ' ~>1.0 .0'
20+ gem ' activeadmin-xls' , ' ~>1.1 .0'
2121```
2222
2323For Active Admin 1.0, you will also have to update config/initializers/active_admin.rb. Update the download\_ links setting to include xls:
@@ -69,6 +69,15 @@ ActiveAdmin.register Post do
6969end
7070```
7171
72+ ### Restrict columns to a list
73+
74+ ``` ruby
75+ # app/admin/posts.rb
76+ ActiveAdmin .register Post do
77+ config.xls_builder.only_columns :title , :author
78+ end
79+ ```
80+
7281## Using the DSL
7382
7483Everything that you do with the config's default builder can be done via
@@ -89,10 +98,13 @@ ActiveAdmin.register Post do
8998 # Do not serialize the header, only output data.
9099 # skip_header
91100
101+ # restrict columns to a list without customization
102+ # only_columns :title, :author
103+
92104 # deleting columns from the report
93105 delete_columns :id , :created_at , :updated_at
94106
95- # adding a column to the report
107+ # adding a column to the report with customization
96108 column(:author ) { |post | " #{ post.author.first_name } #{ post.author.last_name } " }
97109
98110 # inserting additional data with after_filter
0 commit comments