From 3905c9f192c0f13d6ba7ea2af5059485d0b1df51 Mon Sep 17 00:00:00 2001 From: Saverio Trioni Date: Wed, 25 May 2016 00:11:34 +0200 Subject: [PATCH] Support for latest ActiveAdmin version `per_page` The `max_per_page` method has been moved from the controller (hardcoded) to the resource (configurable). See related commit https://github.com/activeadmin/activeadmin/commit/77584fab44544ee5596c9ce1fd526f5e3a5c1e74 This change allows the code to work with both old and new inplementation. --- lib/active_admin/xls/resource_controller_extension.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_admin/xls/resource_controller_extension.rb b/lib/active_admin/xls/resource_controller_extension.rb index 69a248e..21a5ec0 100644 --- a/lib/active_admin/xls/resource_controller_extension.rb +++ b/lib/active_admin/xls/resource_controller_extension.rb @@ -23,7 +23,7 @@ def index_with_xls(&block) # patching per_page to use the CSV record max for pagination when the format is xls def per_page_with_xls if request.format == Mime::Type.lookup_by_extension(:xls) - return max_per_page + return respond_to?(:max_per_page) ? max_per_page : active_admin_config.max_per_page end per_page_without_xls