Tuned last.fm autocomplete to do what i need (:
This commit is contained in:
parent
c9ea9c6a27
commit
aa5d5a51c6
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue