I am using the Active Admin gem and I would like to hide or remove the links on the index page of each model allowing users to download data as CSV, XML or JSON. Is there any way to do this?
There is now an option :download_links
on the index method, so you omit the download links if you want.
For example:
ActiveAdmin.register Post do
index :download_links => false do
# whatever
end
end
You should use it as a option of index, but do not separate it from the column functions. Use it like this.
ActiveAdmin.register Post do
index :download_links => false do
column :title
column :body
end
end
Do not use it like this.This will let all your table columns is displayed, not the only that you specified by column function
index download_links: false
index do
column :title
column :body
end
Since you asked how to remove download links on each page, so the best to do say is to add the following line in config/initializers/active_admin.rb file.
config.namespace :admin do |admin|
admin.download_links = false
end
You can also specify where options you would like to have for downloading the data, like:
config.namespace :admin do |admin|
admin.download_links = [:pdf] # Now, it will only show PDF option.
end
Note: Don't forget to restart your server after you modify a config file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With