I use the current version of Ransack gem with Rails 5 and MySQL and want to implement a search form where I can have two select fields:
1) first dropdown select list should contain the table column attributes eg. first_name, last_name, street
2) second dropdown select list should contain the operator like "equals", "is not", "contains"
and then an input field for the search keyword and a submit button.
In code it should look something like this:
<%= search_form_for @search do |f| %>
<%= f.select :select_criteria, options_for_select([
['first name', :first_name],
['last name', :last_name],
['street', :street]
]), @search.select_criteria %>
<%= f.select :operator, options_for_select([
['contains', :contains],
['is not', :is_not],
['equals', :equals]
]), @search.operator %>
<%= f.search_field :term %>
<%= f.submit "filter" %>
<% end %>
But I can't find any examples in the ransack documentation that covers this case.
How does it look correctly?