Search code examples
twitter-bootstrapruby-on-rails-4.1

Bootstrap search from rails 4


I want to create a search from using the gem 'bootstrap_form' in my RoR application

this is how i proceed :

<%= bootstrap_form_tag(books_search_path, :method => "get", id: "search-form") do |f| %>
 <%= f.search_field :search, params[:search], placeholder: "Search books" %>
 <%= f.submit "Search", :name => nil %>
<% end %>

but i got this error in the first line:

wrong number of arguments (2 for 0..1)


Solution

  • Can you try with this code:

    <%= bootstrap_form_tag(url: books_search_path, method: "get", id: "search-form") do |f| %>
     <%= f.search_field :search, params[:search], placeholder: "Search books" %>
     <%= f.submit "Search" %>
    <% end %>