How do I create English-language list (name1, name2, AND name3) in Ruby on Rails?
- by Angela
Quite possibly there could be a rails magic I've missed, but I'm guessing it will be in Ruby.
I have a model called Company which has_many Contacts.
Suppose Company has Contact 1, Contact 2, Contact 3, and Contact 4.
When I create a textblog for each Contact, I want to output the following (where Contact = Contact 1)
"Hi, Contact 1,
I am also writing to Contact 2, Contact 3, and Contact 4."
So it needs to extract the Contact in the salutation and then list them, inserting "and" before the last Contact in the list.