Skip to content

Instantly share code, notes, and snippets.

@samvincent
Created January 19, 2012 17:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samvincent/1641438 to your computer and use it in GitHub Desktop.
Save samvincent/1641438 to your computer and use it in GitHub Desktop.
Remove download links from index
module ActiveAdmin
module Views
module Pages
class Index < Base
protected
def render_index
renderer_class = find_index_renderer_class(config[:as])
paginated_collection(collection, :entry_name => active_admin_config.resource_name, :download_links => false) do
div :class => 'index_content' do
insert_tag(renderer_class, config, collection)
end
end
end
end
end
end
end
module ActiveAdmin
class ResourceController # < ::InheritedResources::Base
# Since we are shipping ActiveAdmin to clients, we don't want to expose
# all of the freebie :csv, :json, :xml endpoints that ActiveAdmin::ResourceController
# has set by default
#
# Check actionpack-3.0.9/lib/action_controller/metal/mime_responds.rb for api
#
clear_respond_to
respond_to :html
end
end
@awsmsrc
Copy link

awsmsrc commented Jun 17, 2014

after adding as an initializer I can still go to dot csv and get a csv, would be great if someone could point me in the right direction

@willbarrett
Copy link

lukeroberts1990 and I just figured this out. To disable the CSV entirely the easiest thing to do is wrap the ActiveAdmin routes in a format constraint.

constraints format: :html do
  ActiveAdmin.routes(self)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment