jeudi 31 décembre 2015

Rails f.select saving integer not string

I have the following line in a rails form for a new submission:

<%= f.select :department_id, options_from_collection_for_select(@departments, 'id', 'department') %>

I am trying to have it save the department_id as a string, being the actual title of the respective department saved. Instead I am getting the integer value for the ID of the chosen department.

Aucun commentaire:

Enregistrer un commentaire