I'm trying to get the firstname(s) and lastname(s) which have the same id.
My Table Schema looks like this:
| id | nameable_id | nameable_type | value | type |
| 1 | 2 | Person | John | Firstname |
| 2 | 2 | Person | Doe | Lastname |
I want to use a collection_select
with an expected output:
<select name="source[person_id]" id="source_person_id">
<option value="2">John Doe</option></select>`
How can I concatenate these values with the same nameable_id
and order the firstname(s) then the lastname(s)?