HABTM Ruby On Rails 问题
当我执行 user.role_ids 时,我得到一个像 [1,2,3] 这样的 id 列表,是否可以将这些 id 转换为该表的 role.name,这样它看起来像 [开发人员,团队领导] 等?
我需要类似的东西吗
<td><%= user.role_ids.find_by_name(roles_name.to_s) %></td>
When i do user.role_ids i get a list of ids like [1,2,3] is it possible to convert these id's into the role.name of that table so it would look like [Developer, Team Leader] Etc?
Do i need something like
<td><%= user.role_ids.find_by_name(roles_name.to_s) %></td>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不明白你的问题,但是怎么样:
I don't get your question, but how about just: