Skip to content

Instantly share code, notes, and snippets.

@queso
Created October 29, 2010 22:51
Show Gist options
  • Save queso/654609 to your computer and use it in GitHub Desktop.
Save queso/654609 to your computer and use it in GitHub Desktop.
def index
@query = params[:query]
@page = params.fetch(:page, 1)
if @query.nil?
@wines = Wine.paginate(:page => @page, :per_page => 9)
logger.info("Doing index, not search")
else
@search = Wine.search do
keywords(@query)
end
@wines = @search.results
logger.info("Doing search for #{@query}")
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @wines }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment