Skip to content

Instantly share code, notes, and snippets.

@levicole
Created May 3, 2009 22:22
Show Gist options
  • Save levicole/106174 to your computer and use it in GitHub Desktop.
Save levicole/106174 to your computer and use it in GitHub Desktop.
def search
@artists = Artist.find_all_by_festival_id(@festival.id, :conditions => ["name LIKE ?", "%#{params[:q]}%"])
respond_to do |wants|
wants.js { render :json => @artists }
end
end
$("#artist_picker").autocomplete("/artists/search", {
formatItem: function(item){
return item.artist.name;
}
}).result(function(event, item) {
alert("The id is: " + item.artist.id)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment