我正在尝试获取具有相同 ID 的名字和姓氏。
我的表架构如下所示:
| id | nameable_id | nameable_type | value | type |
| 1 | 2 | Person | John | Firstname |
| 2 | 2 | Person | Doe | Lastname |
我想使用collection_select
具有预期输出的 a:
<select name="source[person_id]" id="source_person_id">
<option value="2">John Doe</option></select>`
我怎样才能将这些值与相同的值连接起来,nameable_id
然后排序名字然后是姓氏?