I try to send a form_tag with get method like this
= form_tag search_offers_path, method: :get, class: 'sort-form form inputs-underline' do
.sort-inputs
.input-group.inputs-underline.min-width-150px.sort-input
= label_tag :sort_by, 'Sort by'
= select_tag :sort_by, options_for_select([["Sort by", ""], ["User level", "user_level"], ["Success rating", "user_average_overall_rating"]]), class: "form-control"
.input-group.inputs-underline.min-width-150px.sort-input
= label_tag :sort_direction, 'Sort direction'
= select_tag :sort_direction, options_for_select([["Sort direction", ""], ["Ascending", "asc"], ["Descending", "desc"]]), class: "form-control"
But I don't understand why it becomes a POST as form_tag default
Started POST "/offers/search" for 127.0.0.1 at 2018-01-04 12:35:18 +0700
ActionController::RoutingError (No route matches [POST] "/offers/search"):
Anyone has a hint?
UPDATE: I checked the HTML generated based on the feedback and see that data-remote = true (although I have never set it and I don't want an ajax request, too).
<%= form_tag({}, {:method => :get, class: 'sort-form form inputs-underline'}) do %>
Try this one. You can definitely get your solution.