I am a novice in RoR.
I have this line in the code along with other select objects.
<%= f.select :from_branch, options_from_collection_for_select(@branches, :id, :name, @form.from_branch), {}, :disabled => params[:repoid].blank? %>
In the webpage, when there is an error in any input, the form reloads and keeps the previously entered values intact. But for the above select tag, it resets it to the first entry. There are no blanks in the collection.
Say there are three values in the collection - A, B, C. A is the first record and selected. I select C and submit the form. Due to an error in the form it reloads. Now I want this field to have C. Instead it again goes back to A.
Any thoughts on how do I achieve this?