dimanche 29 mars 2015

Solr Sunspot Autocomplete Text Field Not Working

I am using the sunspot_autocomplete gem to implement auto suggest to my search bar. Just need some help creating the text field. I am using rails 3.


Before I installed the gem, my search bar's code looked like this:



<%= form_tag dairies_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search], style:"width:550px; height:30px;", :autofocus => true %><br>
<%= submit_tag "Search!", :name => nil, class: "btn btn-primary btn-lg", style: "margin-top:20px" %>
</p>
<% end %>


The autocomplete gem requires this code for a text field:



<%= autosuggest_text_field "dairy", "title", "http://ift.tt/1jPxatM", "dairy_title"%>


My question is do I replace all of the search bar code with that ^ or do I just replace the text_field_tag line? I have either been getting errors, or the entire code shows up on my website. Sorry for the beginner question. Still lots to learn! Thank you for your help.


Aucun commentaire:

Enregistrer un commentaire