I check current page with rails 5.1.2 and no problem, but rails 6.1.1 error wrong number of arguments (given 0, expected 1)
<% if current_page?(controller: 'categories', action: 'new')%>
<%= link_to "←".html_safe + @shop.name, shops_path, class: "btn btn-sm btn-primary" %>
<%else%>
<%= link_to "← Volver".html_safe, new_shop_category_path, class: "btn btn-sm btn-primary" %>
<%end%>
My first solution is
<% if controller_name == 'categories' && action_name == 'new'%>
but I would like to know the problem
any idea? Thanks!
Pass a hash instead of keyword arguments:
current_page?({controller: 'categories', action: 'new'})
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