I have the following range, I want to use the pluralize method until there are 1 elements, I want to display 1 element, at the moment it has 0 elements by default. If something is added, it says 1 element
<span id="cartitems"> <%=@size%> items </span>
Please use Rails I18n and write something like:
I18n.t('items', count: @size)
and then in the file config/locales/en.yml:
config/locales/en.yml
en: items: zero: "no items" one: "one item" other: "%{count} items"
Do it instead
<%= pluralize(@size, 'item') %>
Hope this helps!
How about using pluralize
<%= pluralize @size, 'item' %>