There are two forms on the site, the 1st is the product filter, the 2nd is the sorting (drop-down list). I need that when selecting parameters in the filter, I could sort by the filtered parameters.
Now I did this: I added the hidden_field_tag in each form and specified the url parameter as a value:
= hidden_field_tag :color, params[:color] But this option works with errors (parameters are duplicated in url)
Found an option how to do it all with the help of the link:
= link_to 'Сортировка по цвету', root_path(params.merge({color: :white})) But to apply this solution to the drop-down list (select_tag) does not work.
- if params[:sort].present? = hidden_field_tag :sort, params[:sort]- if params[:sort].present? = hidden_field_tag :sort, params[:sort]but in my opinion some kind of bike is obtained) - Pavel Scheglovselecttag, with the sorting options, you must specify theformattribute that contains the filter form identifier. - MAXOPKA<form id="my_filter_form" >...</form>. Select sort options<select form="my_filter_form" >...</select>- MAXOPKA