I was following Ryan Bates screencast and building a basic search, but decided I needed something better than plain MySQL text search and was hoping the Sol Sunspot gem might work.
As per the screencast http://media.railscasts.com/videos/037_simple_search_form.mov, I have setup my search within my model.
My controller has a simple
def index @tasks = Task.search(params) end
And my model has
def self.search(params)
if params[:search]
search do
keywords params[:search]
paginate :page=>params[:page], :per_page =>20
end
else
select('id,title,desc').paginate(:page=>params[:page], :per_page =>20)
end
end
When I load the page without a seach, I get the correct output.
When I provide a search term, I'm getting
wrong number of arguments (0 for 1)
I've tried both 'search do', and 'Task.search do', as that seems to be the difference between the tutorials I've seen http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html, and the way I'm doing it, being passed from the controller into a method.
Any suggestions on how to get this going??