Created
October 29, 2010 22:51
-
-
Save queso/654609 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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