So in my model a user has many roles through assignments and a role can have many users through assignments. I’ve managed to get the function for creating new assignments up and running but I want to display all the roles a user can perform on the user index page (which lists all the users).
My code for the users stub view thus far is:
<td><%= user.email %></td>
<td><%= user.phone %></td>
<td><%= user.roles.select("description")%></td>
The problem here is that instead of displaying the description for the role the output is:
Any pointers would be much appreciated. Thank you in advance!
Map the relation into an array of the strings, so that:
becomes:
or:
to join it into a single comma-separated string.