Reputation: 2202
How can I make my symbol dynamic with an incremental number like this:
@order.products.each do |product,num|
= f.input :aanbod+num.to_s
Upvotes: 13
Views: 5161
Reputation: 77786
This form is equivalent to "aanbod#{num}".to_sym
and more concise:
= f.input :"aanbod#{num}"
Upvotes: 24
Reputation: 34774
= f.input ("aanbod" + num.to_s).to_sym
or
= f.input "aanbod#{num}".to_sym
Upvotes: 6