Can’t seem to find an example of this anywhere - how do I populate a
select list in a form from a database?
I have a form to create a new task. The task is for a client, so there
should be a select list populated from my clients table. I thought this
would work:
<%= select ‘task’, ‘client_id’, Client.find_all, “id”, “name” %>
but I get this error:
undefined method `stringify_keys’ for “name”:String
Obviously I’m missing something…
And then is this going to work properly when I’m using the same form
partial to edit the task?
It populates the select with the city names but returns the city_id.
Nick C. wrote:
Can’t seem to find an example of this anywhere - how do I populate a
select list in a form from a database?
I have a form to create a new task. The task is for a client, so there
should be a select list populated from my clients table. I thought this
would work:
<%= select ‘task’, ‘client_id’, Client.find_all, “id”, “name” %>
but I get this error:
undefined method `stringify_keys’ for “name”:String
Obviously I’m missing something…
And then is this going to work properly when I’m using the same form
partial to edit the task?