This is my form:
<%= form_tag("/adverts", :method => "get") do %>
Order by:
<%= select_tag :order_by, options_for_select([['Ascending', 'ASC'], ['Descending', 'DESC']])%>
<%= text_field_tag :text%>
<%= submit_tag 'Change' %>
<% end %>
In my Adverts controller, index method, for now I am not doing anything and I can see that it is getting correct values from form,
=>but when page reloads after submission, fields values are empty but I want them to retain values.
So if I enter some text in text field, that text will still be there after submitting form .
options_for_selectandtext_field_tag? That's where you can find the answer to your question.