From 9efadf880471850ac8eafbc2b4bf76ed6a3eca06 Mon Sep 17 00:00:00 2001 From: Liam <43280985+LiamAshdown@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:53:44 +0100 Subject: [PATCH] fix: Update `permitted_attributes` to support the latest version of administrate (#7644) This fixes an issue where permitted_attributes throws an error of ArgumentError (wrong number of arguments (given 1, expected 0)): This is because we now bring in the latest version of administrate and administrate changes the way permitted_attributes works; it now passes an action parameter to permitted_attributes. This means we need to update permitted_attributes to accept that new parameter. Fixes: #7592 --- app/dashboards/account_dashboard.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/dashboards/account_dashboard.rb b/app/dashboards/account_dashboard.rb index 50cd3f8f6..fea975c0a 100644 --- a/app/dashboards/account_dashboard.rb +++ b/app/dashboards/account_dashboard.rb @@ -86,7 +86,10 @@ class AccountDashboard < Administrate::BaseDashboard "##{account.id} #{account.name}" end - def permitted_attributes + # We do not use the action parameter but we still need to define it + # to prevent an error from being raised (wrong number of arguments) + # Reference: https://github.com/thoughtbot/administrate/pull/2356/files#diff-4e220b661b88f9a19ac527c50d6f1577ef6ab7b0bed2bfdf048e22e6bfa74a05R204 + def permitted_attributes(action) super + [limits: {}] end end