From dffe7966f66a589b47701a6fd329f9d62b689d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 19 Sep 2021 16:22:53 +0200 Subject: [PATCH] Fix keyword arguments in action components calls We were passing a hash of options instead of converting them to keyword parameters, which resulted in warnings on Ruby 2.7: ``` app/components/admin/table_actions_component.html.erb:5: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call app/components/admin/table_actions_component.html.erb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call app/components/admin/widget/cards/row_component.html.erb:20: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call app/components/admin/widget/cards/table_component.html.erb:14: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call ``` --- app/components/admin/table_actions_component.html.erb | 4 ++-- app/components/admin/widget/cards/row_component.html.erb | 2 +- app/components/admin/widget/cards/table_component.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/admin/table_actions_component.html.erb b/app/components/admin/table_actions_component.html.erb index 0bc434bac..58c6b2763 100644 --- a/app/components/admin/table_actions_component.html.erb +++ b/app/components/admin/table_actions_component.html.erb @@ -2,10 +2,10 @@ <%= content %> <% if actions.include?(:edit) %> - <%= action(:edit, edit_options.merge(text: edit_text, path: edit_path)) %> + <%= action(:edit, **edit_options.merge(text: edit_text, path: edit_path)) %> <% end %> <% if actions.include?(:destroy) %> - <%= action(:destroy, destroy_options.merge(text: destroy_text, path: destroy_path)) %> + <%= action(:destroy, **destroy_options.merge(text: destroy_text, path: destroy_path)) %> <% end %> diff --git a/app/components/admin/widget/cards/row_component.html.erb b/app/components/admin/widget/cards/row_component.html.erb index c66b28708..1a1121df3 100644 --- a/app/components/admin/widget/cards/row_component.html.erb +++ b/app/components/admin/widget/cards/row_component.html.erb @@ -17,6 +17,6 @@ <% end %> - <%= render Admin::TableActionsComponent.new(card, options) %> + <%= render Admin::TableActionsComponent.new(card, **options) %> diff --git a/app/components/admin/widget/cards/table_component.html.erb b/app/components/admin/widget/cards/table_component.html.erb index 3a3cf9720..f3397df53 100644 --- a/app/components/admin/widget/cards/table_component.html.erb +++ b/app/components/admin/widget/cards/table_component.html.erb @@ -11,7 +11,7 @@ <% cards.each do |card| %> - <%= render Admin::Widget::Cards::RowComponent.new(card, options) %> + <%= render Admin::Widget::Cards::RowComponent.new(card, **options) %> <% end %>