0

I have this line on box model

   acts_as_ferret :fields => [ :model ]

of course, box table has a field named model.

this is the search action or the catalog controller

   def search
     @page_title = "Busqueda"
     if params[:commit] == "Search" || params[:q]
        @boxes = Box.find_with_ferret(params[:q].to_s.upcase)
     unless @boxes.size > 0
        flash.now[:notice] = "No boxess found matching your criteria"
end

and thats are the search views ,this is _search_box.html.erb

    <%= form_tag({:action => "search"}, {:method => "get"} do ) %>
    <%= text_field_tag :q %>
    <%= submit_tag "Buscar" %>
    <% end %>

and this is search.html.erb

   <% render :partial => "search_box" %>
   <% if @boxes %>
   <p>Your search "<%= params[:q] %>" produced
   <%= pluralize @boxes.size, "result" %>:</p>
   <%= render(:partial => "boxes") %>
   <% end %>

Seems correct but the search always returns 0 results.

Frederick Cheung
  • 83,189
  • 8
  • 152
  • 174
user3447780
  • 97
  • 1
  • 6

0 Answers0