From aa5d5a51c66fc70f03fe2350a81166188d72c00a Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Sat, 18 Jun 2011 05:17:10 +0400 Subject: [PATCH] Tuned last.fm autocomplete to do what i need (: --- app/controllers/artist_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/artist_controller.rb b/app/controllers/artist_controller.rb index 53daa41..015126e 100644 --- a/app/controllers/artist_controller.rb +++ b/app/controllers/artist_controller.rb @@ -55,7 +55,7 @@ class ArtistController < ApplicationController end render :json => { :query => params[:query], - :suggestions => suggestions + :suggestions => suggestions.take(10) } end @@ -63,7 +63,7 @@ class ArtistController < ApplicationController return nil if query.nil? or query.strip.empty? json = ActiveSupport::JSON.decode(open( 'http://www.last.fm/search/autocomplete' << - '?q=' << URI.escape(query) + '?rows=30&q=' << URI.escape(query) ).read) return json.empty? ? nil : json end