I have some rails-bootstrap-form code in a header partial that gets rendered in the Rails 4 application layout:
<div class="navbar-form navbar-right">
<%= bootstrap_form_tag controller: 'devices', action: 'index', method: 'get' do |f| %>
<%= f.search_field :search, hide_label: true, placeholder: 'Search' %>
<%= f.submit "Submit", :name => nil %>
<% end %>
</div>
I want this search form to always perform a GET
request on the devices controller's index action. The search doesn't actually link to the devices index url, it appends the search parameter to the current url like this: /devices/1?search=foo
. Since it just appends to the current URL, the search works fine from /devices
.
I thought that if I pass in controller: 'devices', action: 'index', method: 'get'
to bootstrap_form_tag
it would force the URL to rewrite, but I'm not having any luck.