Hi Gurus,
I had a form with a collection
<%= f.collection_select :patient_id, Patient.find_main, :id, :namer %>
Where the user selected the :patient_id. I’ve now reconfigured the
rails app so that the controller for this form is passed :patient_id
in the params hash. I no longer want the user to see this selection,
but I need to update :patient_id in the model.
I first just made it disappear with
<%= f.collection_select :patient_id, Patient.find_main, :id, :namer %>
where #disappear { display: none; }But that seemed inelegant. I found hidden_field and hidden_field_tag
in the rails docs, but can’t seem to get the right syntax. For
example,
<%= hidden_field_tag :patient_id, :patient_id %>
Is not updating :patient_id in the model.
Can someone give guidance on the proper usage of hidden_field/
hidden_field_tag, or if I’m totally off base, what I should be putting
into the form to hide this transaction?
Many TIA,
Craig