Orsay Orsay - 8 months ago 44
Ruby Question

How to write inline Ruby slim

I would like to have this H2 result in my view :

Lot 1

My views is write in slim and I use locales variables for

How can I manage to put this both element (
and index) on the same line.

- @products.each_with_index do |product, index|
h1 = product.title
h2 = t('product.lot') + (index + 1)

For the moment I have a synthax error.



h2 = t('product.lot') + (index + 1).to_s 

If think the issue is that you are making a concat between a string and a number

Wait, probably the best solution is interpolation because you need even a space

h2 = "#{t('product.lot')} #{index + 1}"