I've got a patient profile mode like this:-
class Profile < ActiveRecord::Base
belongs_to :eyes, class_name: "EyeColor", foreign_key: "eyes"
end
the database table has an integer called eyes
I have an EyeColor model which simply has an ID and Description (text for the colour)
and I've made a form which has a collection_select on it like this:-
<div class="field">
<%= f.label :eyes %><br>
<%= f.collection_select :eyes, EyeColor.all, :id, :description %>
</div>
now when I attempt to update the record via the form, I get the following:-
ActiveRecord::AssociationTypeMismatch (EyeColor(#45428760) expected, got String(#19387428))
I'm sure it's something simple, but any ideas what I have done wrong?