From: Jacob Basham Date: 2007-11-09T15:16:24+09:00 Subject: Re: user.roles -- How do you list the role names of the user? Voila <%= user.roles.join(", ") %> http://www.ruby-doc.org/core/classes/Array.html#M002205 Jake On Nov 8, 2007, at 11:58 PM, Bob Sanders wrote: > Hello, > > I want to list out the role names that belong to a user. I have > user.roles as the table, so I'm interested in the "name" column on > that > roles table. If I want to separate the names using a comma [ e.g. > using > .join(", ") ], how would I do it? > > For instance: > > <% for role in user.roles %><% role.name %><% end %> > > displays all of the roles of the user, but without the comma. There > must > be a better way to do it (a less tedious way), and also separate them > with commas? > > Any idea? > -- > Posted via http://www.ruby-forum.com/. >