Skip to content

Instantly share code, notes, and snippets.

@buddylindsey
Created May 18, 2011 04:55
Show Gist options
  • Select an option

  • Save buddylindsey/978015 to your computer and use it in GitHub Desktop.

Select an option

Save buddylindsey/978015 to your computer and use it in GitHub Desktop.
Rails Side of jQuery AJAX
class GenresController < ApplicationController
def all
snippet = params[:genre]
@genres = Genre.where("name LIKE '%#{snippet}%'")
respond_to do |format|
format.json do
render :json => @genres.map(&:name)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment