I have a sample model in which belongs_to a patient model.Using rails-jquery-autocomplete I have managed to implement an autocomplete field where one can search patient's code and it works well. However when editing the form, the patient code is empty on the form. How should I fix it?
App/views/sample/_form.html.erb
<div class="field">
<%= f.label :patient_code %><br>
<%= f.hidden_field :patient_id, id: 'patient_id' %>
<%= f.autocomplete_field :patient_code, autocomplete_patient_code_samples_path, id_element: '#patient_id' %>
</div>