lundi 4 février 2019

If X or Y condition in rails

I am beginning with rails and I'm trying to create an if condition.

I want to add a S to a word if its length is greater than 1.

<% if @user.groups.length == 0 || 1 %>
   <p> débat</p><% else %><p> débats</p>
<% end %>

Here is the result : undefined local variable or method ` 1' for #<#:0x00007ffbb1c47048>

Aucun commentaire:

Enregistrer un commentaire