Created
May 18, 2011 04:55
-
-
Save buddylindsey/978015 to your computer and use it in GitHub Desktop.
Rails Side of jQuery AJAX
This file contains hidden or 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
| 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