has moved and is now available at

Rails Tip Snippet: Create a comma-seperate list

27 March 2007

Do you have the need to create a list of roles a certain user belongs to? Enumerate the users attached to a company? All you want is a simple list with the names seperated by commas.

Users: John, Dick, Harry

With Ruby on Rails this is really easy. You probably have a collection of user objects. All you want is a list of names:

@users.collect{|u|}.join(‘, ‘)
Read more Tip Snippets?