Hi, I am trying to search ‘name’ column in ‘Title’ table with the
following script. When I search using names, it returns zero result.
However, when I enter id number of a field, it returns a result. Can
anyone tell me what I am doing wrong?
class Title
acts_as_ferret :fields => [:name]
class CatalogController
def search
@page_title = “search”
if params[:commit] == “Search” || params[:q]
@titles = Title.find_by_contents(params[:q].to_s.upcase)
unless @titles.size > 0
flash.now[:notice] = “No titles find matching your criteria”
end
end
end
#search.rhtml
<% if @titles %>
Your search "<%= params[:q] %>" produced <%= pluralize @titles.size, "result" %>:
<%= render(:partial => "titles") %> <% end %>