mardi 10 novembre 2020

Having trouble using unless current_page? to hide a button

I'm trying to hide this button from all the show pages of the Rooms model. I have an array of the rooms id stored in @extra but whenever I try to use current_page?(room_path(@extra)) it doesn't work, but when I specify the id, for example, current_page?(room_path(6)) it works and hides the button. What am I doing wrong?

<% unless current_page?(controller: 'rooms') || current_page?(room_path(@extra))%>

   <button onclick="myFunction()" class="button btn btn-light bg-white rounded-pill shadow-sm px-4 mb-4" 
   style="vertical-align:middle">
   <span>
      <small class="text-uppercase font-weight-bold"> Nav-bar Toggle</small>
   </span>
</button>

      <% end %>

Aucun commentaire:

Enregistrer un commentaire