I am using Ruby on Rails v3.0.9 and I would like to "transform" an array of strings in a sentence including punctuation. That is, if I have an array like the following:
["element 1", "element 2", "element 3"]
I would like to get\build:
# Note: I added 'Elements are: ' at the begin, ',' between elements and '.' at
# the end.
"Elements are: element 1, element 2, element 3."
How can I do that?
to_sentence
withjoin(", ")
– Kalinin